You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/documentation/stories/code-coverage.md
+17-4Lines changed: 17 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -8,9 +8,9 @@ To generate a coverage report run the following command in the root of your proj
8
8
ng test --watch=false --code-coverage
9
9
```
10
10
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.
12
12
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.
14
14
15
15
## Code Coverage Enforcement
16
16
@@ -27,6 +27,19 @@ coverageIstanbulReporter: {
27
27
functions:80
28
28
}
29
29
}
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
+
```
31
44
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