Skip to content

Commit ac9c428

Browse files
manueledonesmhevery
authored andcommitted
docs: replace deprecated karma-coverage-istanbul-reporter (angular#41246)
'karma-coverage-istanbul-reporter' usage has been deprecated since version 11. Please install 'karma-coverage' and update 'karma.conf.js.' For more info, see https://github.com/karma-runner/karma-coverage/blob/master/README.md PR Close angular#41246
1 parent e239941 commit ac9c428

File tree

1 file changed

+19
-12
lines changed

1 file changed

+19
-12
lines changed

aio/content/guide/testing-code-coverage.md

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,20 +38,27 @@ The code coverage percentages let you estimate how much of your code is tested.
3838
If your team decides on a set minimum amount to be unit tested, you can enforce this minimum with the Angular CLI.
3939

4040
For example, suppose you want the code base to have a minimum of 80% code coverage.
41-
To enable this, open the [Karma](https://karma-runner.github.io) test platform configuration file, `karma.conf.js`, and add the following in the `coverageIstanbulReporter:` key.
42-
43-
```
44-
coverageIstanbulReporter: {
45-
reports: [ 'html', 'lcovonly' ],
46-
fixWebpackSourcePaths: true,
47-
thresholds: {
48-
statements: 80,
49-
lines: 80,
50-
branches: 80,
51-
functions: 80
41+
To enable this, open the [Karma](https://karma-runner.github.io) test platform configuration file, `karma.conf.js`, and add the `check` property in the `coverageReporter:` key.
42+
43+
```js
44+
coverageReporter: {
45+
dir: require('path').join(__dirname, './coverage/<project-name>'),
46+
subdir: '.',
47+
reporters: [
48+
{ type: 'html' },
49+
{ type: 'text-summary' }
50+
],
51+
check: {
52+
global: {
53+
statements: 80,
54+
branches: 80,
55+
functions: 80,
56+
lines: 80
57+
}
5258
}
5359
}
5460
```
5561

56-
The `thresholds` property causes the tool to enforce a minimum of 80% code coverage when the unit tests are run in the project.
62+
The `check` property causes the tool to enforce a minimum of 80% code coverage when the unit tests are run in the project.
5763

64+
You can find more info about the different coverage configuration options [here](https://github.com/karma-runner/karma-coverage/blob/master/docs/configuration.md).

0 commit comments

Comments
 (0)