spec作用
spec文件是你的源文件的单元测试。Angular应用程序的约定是每个.ts文件都有一个.spec.ts文件。当你使用’ng test’命令时,它们通过Karma任务运行器使用Jasmine javascript测试框架运行。
取消自动生成
创建项目时
添加参数--skip-tests
ng new <name> --skip-tests
创建项目后
angular.json
添加"skipTests": true
"schematics": {
"@schematics/angular:component": {
"style": "scss",
"skipTests": true
},
"@schematics/angular:class": {
"skipTests": true
},
"@schematics/angular:directive": {
"skipTests": true
},
"@schematics/angular:guard": {
"skipTests": true
},
"@schematics/angular:interceptor": {
"skipTests": true
},
"@schematics/angular:pipe": {
"skipTests": true
},
"@schematics/angular:service": {
"skipTests": true
},
"@schematics/angular:application": {
"strict": true
}
}