The --skip-tests
flag for ng new
didn't quite match my expectations as a developer.
Angular CLI: 1.6.0-beta.0
Node: 8.4.0
OS: linux x64
Angular:
...
ng new my-project --skip-tests
```create my-project/README.md (1032 bytes)
create my-project/.angular-cli.json (1528 bytes)
create my-project/.editorconfig (245 bytes)
create my-project/.gitignore (516 bytes)
create my-project/src/assets/.gitkeep (0 bytes)
create my-project/src/environments/environment.prod.ts (51 bytes)
create my-project/src/environments/environment.ts (387 bytes)
create my-project/src/favicon.ico (5430 bytes)
create my-project/src/index.html (296 bytes)
create my-project/src/main.ts (370 bytes)
create my-project/src/polyfills.ts (2667 bytes)
create my-project/src/styles.css (80 bytes)
create my-project/src/test.ts (1085 bytes)
create my-project/src/tsconfig.app.json (211 bytes)
create my-project/src/tsconfig.spec.json (304 bytes)
create my-project/src/typings.d.ts (104 bytes)
create my-project/e2e/app.e2e-spec.ts (292 bytes)
create my-project/e2e/app.po.ts (208 bytes)
create my-project/e2e/tsconfig.e2e.json (235 bytes)
create my-project/karma.conf.js (923 bytes)
create my-project/package.json (1322 bytes)
create my-project/protractor.conf.js (722 bytes)
create my-project/tsconfig.json (363 bytes)
create my-project/tslint.json (2985 bytes)
create my-project/src/app/app.module.ts (316 bytes)
create my-project/src/app/app.component.css (0 bytes)
create my-project/src/app/app.component.html (1120 bytes)
create my-project/src/app/app.component.ts (207 bytes)
### Desired behavior
```create my-project/README.md (1032 bytes)
create my-project/.angular-cli.json (1528 bytes)
create my-project/.editorconfig (245 bytes)
create my-project/.gitignore (516 bytes)
create my-project/src/assets/.gitkeep (0 bytes)
create my-project/src/environments/environment.prod.ts (51 bytes)
create my-project/src/environments/environment.ts (387 bytes)
create my-project/src/favicon.ico (5430 bytes)
create my-project/src/index.html (296 bytes)
create my-project/src/main.ts (370 bytes)
create my-project/src/polyfills.ts (2667 bytes)
create my-project/src/styles.css (80 bytes)
create my-project/src/tsconfig.app.json (211 bytes)
create my-project/src/typings.d.ts (104 bytes)
create my-project/package.json (1322 bytes)
create my-project/tsconfig.json (363 bytes)
create my-project/tslint.json (2985 bytes)
create my-project/src/app/app.module.ts (316 bytes)
create my-project/src/app/app.component.css (0 bytes)
create my-project/src/app/app.component.html (1120 bytes)
create my-project/src/app/app.component.ts (207 bytes)
Completely agree with this. In my mind, Skipping tests removes anything to do with testing. Karma, E2E, spec files and configs (inside angular-cli.json), etc...
On the other hand, I also find it ridiculous the only option is to use -minimal
which removes tslint/linting.
Tested on release and beta versions, still having this problem.
Tested with CLI 6.0.3. Testing setup is still being generated when using --skip-tests
flag.
Angular CLI: 6.0.5
Node: 8.11.2
OS: darwin x64
Angular: 6.0.3
Would be really nice to have this feature covered in the next releases.
Angular CLI 6.0.7 still the same.
# ng new test-app --minimal --skip-tests --dry-run
CREATE test-app/README.md (1024 bytes)
CREATE test-app/angular.json (4100 bytes)
CREATE test-app/package.json (1312 bytes)
CREATE test-app/tsconfig.json (384 bytes)
CREATE test-app/tslint.json (2805 bytes)
CREATE test-app/.editorconfig (245 bytes)
CREATE test-app/.gitignore (503 bytes)
CREATE test-app/src/environments/environment.prod.ts (51 bytes)
CREATE test-app/src/environments/environment.ts (631 bytes)
CREATE test-app/src/favicon.ico (5430 bytes)
CREATE test-app/src/index.html (294 bytes)
CREATE test-app/src/main.ts (370 bytes)
CREATE test-app/src/polyfills.ts (3194 bytes)
CREATE test-app/src/test.ts (642 bytes)
CREATE test-app/src/assets/.gitkeep (0 bytes)
CREATE test-app/src/styles.css (80 bytes)
CREATE test-app/src/browserslist (375 bytes)
CREATE test-app/src/karma.conf.js (964 bytes)
CREATE test-app/src/tsconfig.app.json (194 bytes)
CREATE test-app/src/tsconfig.spec.json (282 bytes)
CREATE test-app/src/tslint.json (314 bytes)
CREATE test-app/src/app/app.module.ts (314 bytes)
CREATE test-app/src/app/app.component.css (0 bytes)
CREATE test-app/src/app/app.component.html (1141 bytes)
CREATE test-app/src/app/app.component.ts (207 bytes)
CREATE test-app/e2e/protractor.conf.js (752 bytes)
CREATE test-app/e2e/src/app.e2e-spec.ts (304 bytes)
CREATE test-app/e2e/src/app.po.ts (208 bytes)
CREATE test-app/e2e/tsconfig.e2e.json (213 bytes)
NOTE: Run with "dry run" no changes were made.
Tested with @angular/cli 6.0.8:
--skip-tests
still generated e2e files;--skip-e2e
not work.Still an issue in 6.2.2
Just a 'what if' -- for library development, I generally generate a new app and a single library - the app acting as the 'demo' for the library.
Generating without tests (including e2e) makes sense on the top level, but I do unit tests on the library.
A lot of the libraries innards (karma, lint, etc..) extend the upper level, which would then be missing if these do go away.
Figured I'd share - maybe I should just start testing my demos :)
In CLI v7.0.4
the --minimal
flag is already working as expected. No generated test files. 馃憣
In CLI
v7.0.4
the--minimal
flag is already working as expected. No generated test files.
It removes the test files, but also removes linting so it isn't really the right solution. The issue still remains that --skip-tests
should remove ALL testing frameworks, not just unit tests
--minimal
also forces the templates and styles to be inline
Also, --minimal
with --inlineTemplate
and --inlineStyle
set to false is not working.
ng new my-project-no-test --minimal=true --routing=true --skip-tests=true
see https://angular.io/cli/new
ng new my-project-no-test --minimal=true --routing=true --skip-tests=true
see https://angular.io/cli/new
See my comment above. The issue is the --minimal
flag removes linting in addition to removing the testing frameworks. I think this would be fine, as that seems pretty minimal, however the flag's description only says it removes test frameworks and doesn't mention linting:
When true, creates a project without any testing frameworks.
To make things more flexible, there should probably be a --linting
flag
ng new my-project-no-test --minimal=true --routing=true --skip-tests=true
see https://angular.io/cli/newSee my comment above. The issue is the
--minimal
flag removes linting in addition to removing the testing frameworks. I think this would be fine, as that seems pretty minimal, however the flag's description only says it removes test frameworks and doesn't mention linting:When true, creates a project without any testing frameworks.
To make things more flexible, there should probably be a
--linting
flag
Roger!
You have to Use --skipTests
Still a problem in 10.2
This is expected as per description --skipTest
doesn't generate .spec.ts
files, but it still still adds the testing framework and it's config. If you want to create an application without any testing framework use --minimal
.
More info: https://angular.io/cli/new
This is expected as per description
--skipTest
doesn't generate.spec.ts
files, but it still still adds the testing framework and it's config. If you want to create an application without any testing framework use--minimal
.More info: https://angular.io/cli/new
The problem with using --minimal
is that it enforces inline style and templating, and we don't want that. We just want an Angular project without testing.
For anyone wanting to create an Angular project without test packages, files and configurations, I'll leave my conclusions:
Using @angular/[email protected]
Create a project using --skip-tests
.
Remove the following:
e2e
folderkarma.conf.js
angular.json
: the test
and e2e
configuration sections.src/test.ts
npm uninstall @types/jasmine, @types/jasminewd2, jasmine-core, jasmine-spec-reporter, karma, karma-chrome-launcher, karma-coverage-istanbul-reporter, karma-jasmine, karma-jasmine-html-reporter, protractor
Most helpful comment
Completely agree with this. In my mind, Skipping tests removes anything to do with testing. Karma, E2E, spec files and configs (inside angular-cli.json), etc...
On the other hand, I also find it ridiculous the only option is to use
-minimal
which removes tslint/linting.