In Angular 5 and earlier versions, to stop generating the spec files while generationg a component we had to add the following in .angular-cli.json file:
{
...
"defaults": {
"spec": {
"class": false,
"component": false,
"directive": false,
"module": false,
"pipe": false,
"service": false
}
}
}
in Angular 6+, following this link we have to add the next in the new angular.json file, under the schematics section:
....
"schematics": {
"@schematics/angular:component": {
....
"properties": {
....
"spec": {
"type": "boolean",
"description": "Specifies if a spec file is generated.",
"default": false
}
}
}
},
But when generating a new component a new spec file is still created, even after IDE restart, what is missing ?
You can set it in the angular-cli.json as
{
"defaults": {
"component": {
"spec": false
}
}
}
This will disable generating all spec files. If you want to disable on a specific component,
ng g c component-name --spec false
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With