I know it\'s kind of a bad practice, but bear with me:
I\'m using Angular-CLI, particularly ng g
to generate all of my classes. However
You can run this command to disable spec file generation for a specific type of file:
ng set defaults.spec.FILETYPE false
For example:
ng set defaults.spec.component false // Won't generate spec files for .component files
Alternately you can just disable all spec file generation from the angular-cli.json file.
{
...
"defaults": {
"spec": {
"class": false,
"component": false,
"directive": false,
"module": false,
"pipe": false,
"service": false
}
}
}
you can add --spec=false
example
ng g c home --spec=false
log will be
CREATE src/app/home/home.component.scss (0 bytes)
CREATE src/app/home/home.component.html (23 bytes)
CREATE src/app/home/home.component.ts (262 bytes)
UPDATE src/app/app.module.ts (467 bytes)
you can add --skipTests=true|false
if true it wont generate any spec.ts
example : ng g component componentName --skipTests=true
this line wont generate any spec.ts files
EDIT:
Note: As of angular 7 this command doesn't work, even though this command is mentioned on the official website of angular. Here: https://angular.io/cli/generate#component
you can try --skip-tests
when you creating your app like below.
ng new yourProjectName --skip-tests
Add Following code on Angular.json
"schematics": {
"@schematics/angular": {
"component": {
"spec": false
}
}
}