v predchádzajúcej verzii môžu spec.ts vypnúť s .angular-cli.json ako je uvedené nižšie. je nejaký spôsob, ako to urobiť s angular.json vo verzii 6.0.0.
"defaults": {
"component": {
"spec": false
},
"service": {
"spec": false
},
...
}
odpovede:
3 pre odpoveď č. 1vo verzii "6.0.0" * .spec.ts možno vypnúť pomocou angular.json
"schematics": {
"@schematics/angular:component": {
"prefix": "fmyp",
"styleext": "css",
"spec": false
},
"@schematics/angular:directive": {
"prefix": "fmp",
"spec": false
},
"@schematics/angular:module": {
"spec": false
},
"@schematics/angular:service": {
"spec": false
},
"@schematics/angular:pipe": {
"spec": false
},
"@schematics/angular:class": {
"spec": false
}
}
1 pre odpoveď č. 2
Metóda 1:
Môžete tiež vypnúť generáciu spec v čase vytvárania vecí pomocou funkcie Angular-cli pridaním výrazu „--no-spec“
ng generate component my-component --no-spec
Metóda 2: Trvale vypnite v súbore angular.json. Môžete upraviť schémy pre váš projekt.
"schematics": {
"@schematics/angular:component": {
"styleext": "scss",
"spec": false
},
"@schematics/angular:class": {
"spec": false
},
"@schematics/angular:directive": {
"spec": false
},
"@schematics/angular:guard": {
"spec": false
},
"@schematics/angular:module": {
"spec": false
},
"@schematics/angular:pipe": {
"spec": false
},
"@schematics/angular:service": {
"spec": false
}
},