Make ng test --environment=prod fail when tests contain fdescribe, fit, xdescribe or xit
Bug Report or Feature Request (mark with an x)
- [ ] bug report -> please search issues before submitting
- [x] feature request
Versions.
@angular/cli: 1.4.4 node: 8.1.1 os: win32 x64 @angular/animations: 4.3.6 @angular/common: 4.3.6 @angular/compiler: 4.3.6 @angular/core: 4.3.6 @angular/forms: 4.3.6 @angular/http: 4.3.6 @angular/platform-browser: 4.3.6 @angular/platform-browser-dynamic: 4.3.6 @angular/router: 4.3.6 @angular/cli: 1.4.4 @angular/compiler-cli: 4.3.6 @angular/language-service: 4.3.6 typescript: 2.3.4
Repro steps.
create a test with fdescibe, fit, xdescribe or xit
The log given by the failure.
ng test runs only the tests with fdescribe or fit, or ignores tests with xdescribe or xit (which is fine is you are in development mode)
Desired functionality.
if environment prod is defined as build environment in ng test (ng test --environment=prod), make the build/tests fail when they contain fdescribe, fit, xdescribe or xit tests.
That is unexpected behavior for Jasmine. You can include a TSLint rule that will catch the usage of fdescribe, fit, xit, and xdescribe. When your CI runs, have it run lint first. If it fails, you can fail the build. If it passes, you know there are no unwanted test functions and proceed to run ng test.
Hi @timvl,
We will not special case tests with the environment. This is just not a feature we're interested in.
Two things you can do in the meantime;
- use linting to fail tests on CI, or
- in code or your karma.conf, check the environment configuration and replace those functions with error throwing ones. This is probably the closest solution to your feature request.
Closing this as it's really not in the scope of the CLI. Extensibility will probably fix this.
Thanks, that will work for me
for (2), is there a recipe? am trying to use middleware & beforeMiddleware but am not able to get hold of fdescribe / fit.
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.