当我创建一个新组件时,是否有一种方法可以摆脱角spec.ts文件中的2+文件。我知道这是为了测试,但如果我不需要呢。
可能存在一些设置来禁用此特定的测试文件。
发布于 2016-12-06 07:57:22
为角>=8 CLI更新
对于一个组件,请使用以下命令:
ng generate component --skip-tests=true component-name对于单个项目,在angular.json中更改或添加以下内容
{
"projects": {
"{PROJECT_NAME}": {
"schematics": {
"@schematics/angular:component": {
"skipTests": true
}
}
}
}
}对于所有项目的全局设置,请在angular.json中更改或添加以下内容
{
"schematics": {
"@schematics/angular:component": {
"skipTests": true
}
}
}或者通过使用命令行
ng config schematics.@schematics/angular:component.skipTests true<角8
在angular-cli.json内部,将spec.component参数设置为false
{
...
"defaults" : {
...
"spec": {
...
"component": false
}
}
}或者在创建过程中使用--spec=false选项
ng generate component --spec=false component-name发布于 2018-06-23 12:09:57
为角6
ng config schematics.@schematics/angular.component.spec false发布于 2018-10-02 19:33:42
对于角6+,只需运行以下命令:
ng config schematics.@schematics/angular.component.spec false或
只要把这个添加到你的angular.json文件中,你就可以继续了
"schematics": {
"@schematics/angular": {
"component": {
"spec": false
}
}
}注意:在粘贴此检查以检查冲突之前,希望它有助于
https://stackoverflow.com/questions/40990280
复制相似问题