When I run
ng test --watch=false --code-coverage --no-progress
I get
Schema validation failed with the following errors:
Data path ".watch" should be boolean.
I searched but can't find a hit for this error.
The docs (https://github.com/angular/angular-cli/wiki/test) clearly say --watch=false should work.
Other people say it works, for example https://github.com/angular/angular-cli/issues/10711#issuecomment-387704999
I'm on angular/cli 6.2.4. angular 6.1.9
Has anyone encountered this?
Code coverage enforcementlink To enable this, open the Karma test platform configuration file, karma. conf. js , and add the check property in the coverageReporter: key. The check property causes the tool to enforce a minimum of 80% code coverage when the unit tests are run in the project.
Code coverage, also called test coverage, tells you which parts of your code are executed by running the unit and integration tests. Code coverage is typically expressed as percent values, for example, 79% statements, 53% branches, 74% functions, 78% lines.
To calculate the code coverage percentage, simply use the following formula: Code Coverage Percentage = (Number of lines of code executed by a testing algorithm/Total number of lines of code in a system component) * 100.
Do you have more than one project in your angular workspace (angular.json)?
I have received this error when running ng test --watch=false
on a workspace with multiple projects.
You can run the test command on the project by name e.g.
ng run PROJECT_NAME:test --watch=false --code-coverage --no-progress
you need to substitute in the name of your project for PROJECT_NAME
try singleRun: true,
in karma.conf.js configuration, if you want the test to keep on watching for change and running the test automatically.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With