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: apps/site/pages/en/learn/test-runner/collecting-code-coverage.md
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@ authors: RedYetiDev
6
6
7
7
# Collecting code coverage in Node.js
8
8
9
-
Node.js provides built-in support for code coverage through its test runner, which can be enabled using the `--experimental-code-coverage` flag.
9
+
Node.js provides built-in support for code coverage through its test runner, which can be enabled using the [`--experimental-code-coverage`](https://nodejs.org/api/cli.html#--experimental-test-coverage) flag.
10
10
11
11
## What is code coverage?
12
12
@@ -205,9 +205,9 @@ Each of these different methods will produce the same report, with 100% code cov
205
205
206
206
Node.js offers two CLI arguments for managing the inclusion or exclusion of specific files in a coverage report.
207
207
208
-
The `--test-coverage-include` flag restricts the coverage to files that match the provided glob pattern. By default, files in the `/node_modules/` directory are excluded, but this flag allows you to explicitly include them.
208
+
The [`--test-coverage-include`](https://nodejs.org/api/cli.html#--test-coverage-include) flag restricts the coverage to files that match the provided glob pattern. By default, files in the `/node_modules/` directory are excluded, but this flag allows you to explicitly include them.
209
209
210
-
The `--test-coverage-exclude` flag omits files that match the given glob pattern from the coverage report.
210
+
The [`--test-coverage-exclude`](https://nodejs.org/api/cli.html#--test-coverage-exclude) flag omits files that match the given glob pattern from the coverage report.
211
211
212
212
These flags can be used multiple times, and when both are used together, files must adhere to the inclusion rules, while also avoiding the exclusion rules.
213
213
@@ -277,9 +277,9 @@ By default, when all tests pass, Node.js exits with code `0`, which indicates a
277
277
278
278
Node.js currently supports thresholds for all three of the coverages supported:
279
279
280
-
-`--test-coverage-lines` for line coverage.
281
-
-`--test-coverage-branches` for branch coverage.
282
-
-`--test-coverage-functions` for function coverage.
280
+
-[`--test-coverage-lines`](https://nodejs.org/api/cli.html#--test-coverage-linesthreshold) for line coverage.
281
+
-[`--test-coverage-branches`](https://nodejs.org/api/cli.html#--test-coverage-branchesthreshold) for branch coverage.
282
+
-[`--test-coverage-functions`](https://nodejs.org/api/cli.html#--test-coverage-functionsthreshold) for function coverage.
283
283
284
284
If you wanted to require the previous example to have line coverage >= 90%, you could use the `--test-coverage-lines=90` flag.
0 commit comments