x)- [x] bug report -> please search issues before submitting
- [x] feature request
x)- [ ] new
- [ ] build
- [ ] serve
- [x] test
- [ ] e2e
- [ ] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc
node: 8.9.4
npm: 6.1.0
ng: 6.0.4
ng test --prod
After I realized that I had to add a configuration section in angular.json under test architect node (for which was does not appear to be documented anywhere obvious), here is my config:
"configurations": {
"production": {
"sourceMap": false,
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
]
}
}
When I try to add "aot": true, I get the following error:
Schema validation failed with the following errors:
Data path "" should NOT have additional properties(aot).
Which defeats the purpose of trying to run unit tests in prod mode...
Runs unit tests with a production version of a build (including AOT) and works
Late at night, I dream of being on a beach with the pleasing sound of lapping waves as I run ng test --prod
Heya, we don't support using AOT in unit tests. There's an open feature request at https://github.com/angular/angular-cli/issues/6650 for it.
I can say that last week I was actually on a beach and ran ng test a couple of times, never with --prod though. It was pleasant but have to say the glare on my (glossy) laptop monitor was annoying.
It is misleading though, as the wiki states it's possible:
https://github.com/angular/angular-cli/wiki/test
That flag (--prod) does exist, but using a configuration, such as production, does not mean the same options are available as the browser build.
For instance, you can have a production configuration for tests that includes code coverage, which isn't available on the browser build.
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._
Most helpful comment
Heya, we don't support using AOT in unit tests. There's an open feature request at https://github.com/angular/angular-cli/issues/6650 for it.
I can say that last week I was actually on a beach and ran
ng testa couple of times, never with--prodthough. It was pleasant but have to say the glare on my (glossy) laptop monitor was annoying.