Skip to content

Commit fae46d6

Browse files
Broccohansl
authored andcommitted
docs: Update code coverage story.
1 parent a21ce46 commit fae46d6

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

docs/documentation/stories/code-coverage.md

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ To generate a coverage report run the following command in the root of your proj
88
ng test --watch=false --code-coverage
99
```
1010

11-
Once the tests complete a new `/coverage` folder will appear in the project. In your Finder or Windows Explorer open the `index.html` file. You should see a report with your source code and code coverage values.
11+
Once the tests complete a new `/coverage` folder will appear in the project. In your Finder or Windows Explorer open the `index.html` file. You should see a report with your source code and code coverage values.
1212

13-
Using the code coverage percentages we can estimate how much of our code is tested. It is up to your team to determine how much code should be unit tested.
13+
Using the code coverage percentages we can estimate how much of our code is tested. It is up to your team to determine how much code should be unit tested.
1414

1515
## Code Coverage Enforcement
1616

@@ -27,6 +27,19 @@ coverageIstanbulReporter: {
2727
functions: 80
2828
}
2929
}
30-
```
30+
```
31+
32+
The `thresholds` property will enforce a minimum of 80% code coverage when the unit tests are run in the project.
33+
34+
Another option to simplify the usage of code coverage, instead of passing it via the command line every time. Is to set the value within the configuration file `angular.json`.
35+
36+
```json
37+
...
38+
"test": {
39+
"options": {
40+
"codeCoverage": true
41+
}
42+
}
43+
```
3144

32-
The `thresholds` property will enforce a minimum of 80% code coverage when the unit tests are run in the project.
45+
This will produce code coverage results whenever tests are run for the project.

0 commit comments

Comments
 (0)