Test Coverage Integration?
Please provide us with the following information:
- OS? Windows 7, 8 or 10. Linux (which distribution). Mac OSX (Yosemite? El Capitan?)
Mac OS X (El Capitan)
- Versions. Please run
ng --version. If there's nothing outputted, please run in a Terminal: node --version And paste the result here.
angular-cli: 1.0.0-beta.5 node: 6.0.0 os: darwin x64
(node 6.0.0)
- Repro steps. Was this an app that wasn't created using the CLI? What change did you do on your code? etc.
None - feature request.
- The log given by the failure. Normally this include a stack trace and some more information.
None - feature request.
- Mention any other details that might be useful.
Angular-cli sets up Karma/Jasmine and basic unit tests which is really nice; thanks for that. However I'm wondering if there are plans to integrate code coverage reporting and threshold checking into the ng test flow (e.g. with Istanbul/Isparta, or similar).
In my company's starter kits we have a shortlist of things we consider mandatory for a production toolchain; the ability to fail CI when unit test coverage drops below a certain threshold is one of them.
Is code coverage on your radar?
ng test --code-coverage created code coverage for me.
I agree with @yfain. It is not going to fail with Angular CLI 1.0.1. It keeps getting success even I have all threshold 100%.
After upgrading the karma-coverage-istanbul-reporter to 1.2.1 it works as expected.
Thank you @yfain, it is working now...
I can confirm. I updated karma-coverage-istanbul-reporter to 1.2.1 and now I can use the threshold property in the coverageIstanbulReporter config like so:
coverageIstanbulReporter: {
reports: ['html', 'json'],
fixWebpackSourcePaths: true,
thresholds: config.angularCli.codeCoverage ? {
each: { // thresholds per file
statements: 80,
lines: 80,
branches: 80,
functions: 80
}
} : {}
},
This example I made only applies thresholds when code coverage is enabled in the build, else it will use out of date coverage reports.
Am I the only one that finds these config files to be incredibly nuanced and poorly documented over time? What is the point of including this in angular-cli if it doesn't configure it correctly, automatically?
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.