Open Sampath-Lokuge opened 4 years ago
Hi! Check this out: "@schematics/angular:service": { "skipTests": true }
I have standalone and skip tests set in my angular.json
:
"schematics": {
"@ionic/angular-toolkit:page": {
"styleext": "scss",
"standalone": true
},
"@schematics/angular:component": {
"skipTests": true
},
"@schematics/angular:service": {
"skipTests": true
}
},
but running a generate command still doesn't honor them:
❯ ionic g component example
> ng generate component example --project=app
CREATE src/app/example/example.component.scss (0 bytes)
CREATE src/app/example/example.component.html (26 bytes)
CREATE src/app/example/example.component.spec.ts (703 bytes)
CREATE src/app/example/example.component.ts (273 bytes)
[OK] Generated component!
And in the component:
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-example',
templateUrl: './example.component.html',
styleUrls: ['./example.component.scss'],
})
export class ExampleComponent implements OnInit {
constructor() { }
ngOnInit() {}
}
This is a brand new project I scaffolded in the last hour, I'm running:
"dependencies": {
"@angular/animations": "^18.0.0",
"@angular/common": "^18.0.0",
"@angular/compiler": "^18.0.0",
"@angular/core": "^18.0.0",
"@angular/forms": "^18.0.0",
"@angular/platform-browser": "^18.0.0",
"@angular/platform-browser-dynamic": "^18.0.0",
"@angular/router": "^18.0.0",
"@capacitor/app": "6.0.1",
"@capacitor/core": "6.1.2",
"@capacitor/haptics": "6.0.1",
"@capacitor/keyboard": "6.0.2",
"@capacitor/status-bar": "6.0.1",
"@ionic/angular": "^8.0.0",
"ionicons": "^7.2.1",
"rxjs": "~7.8.0",
"tslib": "^2.3.0",
"zone.js": "~0.14.2"
},
"devDependencies": {
"@angular-devkit/build-angular": "^18.0.0",
"@angular-eslint/builder": "^18.0.0",
"@angular-eslint/eslint-plugin": "^18.0.0",
"@angular-eslint/eslint-plugin-template": "^18.0.0",
"@angular-eslint/schematics": "^18.0.0",
"@angular-eslint/template-parser": "^18.0.0",
"@angular/cli": "^18.0.0",
"@angular/compiler-cli": "^18.0.0",
"@angular/language-service": "^18.0.0",
"@capacitor/cli": "6.1.2",
"@ionic/angular-toolkit": "^11.0.1",
"@types/jasmine": "~5.1.0",
"@typescript-eslint/eslint-plugin": "^6.0.0",
"@typescript-eslint/parser": "^6.0.0",
"eslint": "^8.57.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jsdoc": "^48.2.1",
"eslint-plugin-prefer-arrow": "1.2.2",
"jasmine-core": "~5.1.0",
"jasmine-spec-reporter": "~5.0.0",
"karma": "~6.4.0",
"karma-chrome-launcher": "~3.2.0",
"karma-coverage": "~2.2.0",
"karma-jasmine": "~5.1.0",
"karma-jasmine-html-reporter": "~2.1.0",
"typescript": "~5.4.0"
},
Running ionic version
:
❯ ionic version
7.2.0
I have realised what I was doing wrong.
First I was targeting @schematics/angular:component
, and second I was using skipTests
when its spec
for the ionic generator:
"schematics": {
"@ionic/angular-toolkit:page": {
"styleext": "scss",
"standalone": true,
"spec": false
},
"@ionic/angular-toolkit:component": {
"standalone": true,
"spec": false
},
"@ionic/angular-toolkit:service": {
"spec": false
}
},
Hi,
CLI
ionic g service core/services/utils/storage
angular.json
and tried this too:
But still above CLI generates
spec
file.If I use this CLI then it works without
spec
fileionic g service core/services/utils/toast --skipTests=true
So how to configure this feature globally using
angular.json
?Ionic:
Ionic CLI : 6.9.2 (C:\Users\Sampath\AppData\Roaming\npm\node_modules\@ionic\cli) Ionic Framework : @ionic/angular 5.3.3 @angular-devkit/build-angular : 0.1001.2 @angular-devkit/schematics : 10.0.8 @angular/cli : 10.1.2 @ionic/angular-toolkit : 2.3.3
Capacitor:
Capacitor CLI : 2.4.1 @capacitor/core : 2.4.1
Utility:
cordova-res : 0.14.0 native-run (update available: 0.3.0) : 0.2.5
System:
NodeJS : v12.13.1 (C:\Program Files\nodejs\node.exe) npm : 6.12.1 OS : Windows 10