Updated for Angular >=8 CLI
For one component, use the following command:
ng generate component --skipTests=true component-name
For a single project, change or add the following in your angular.json:
{
"projects": {
"{PROJECT_NAME}": {
"schematics": {
"@schematics/angular:component": {
"skipTests": true
}
}
}
}
}
For a global setting for all your projects, change or add the following in your angular.json:
{
"schematics": {
"@schematics/angular:component": {
"skipTests": true
}
}
}
Or by using the command line
ng config schematics.@schematics/angular:component.skipTests true
For Angular < 8
Inside your angular-cli.json set the spec.component parameter to false:
{
...
"defaults" : {
...
"spec": {
...
"component": false
}
}
}
or use the --spec=false option during creation
ng generate component --spec=false component-name