From af488c6ab9507db1e692d961b4af6e502b307ffd Mon Sep 17 00:00:00 2001 From: Matteo Collina Date: Sat, 23 May 2026 13:59:13 +0200 Subject: [PATCH] test_runner: add --test-coverage flag Signed-off-by: Matteo Collina --- doc/api/cli.md | 43 +++++++++++-------- doc/api/test.md | 12 +++--- doc/node-config-schema.json | 8 ++++ doc/node.1 | 12 +++--- lib/internal/process/pre_execution.js | 5 +-- lib/internal/test_runner/runner.js | 3 +- lib/internal/test_runner/utils.js | 2 +- src/node_options.cc | 4 +- .../rc/namespace-with-disallowed-envvar.json | 2 +- .../options-propagation/node.config.json | 2 +- test/parallel/test-runner-cli.js | 2 +- ...test-runner-coverage-default-exclusion.mjs | 6 +-- .../test-runner-coverage-source-map.js | 2 +- .../test-runner-coverage-thresholds.js | 14 +++--- test/parallel/test-runner-coverage.js | 32 +++++++------- test/parallel/test-runner-flag-propagation.js | 6 ++- 16 files changed, 86 insertions(+), 69 deletions(-) diff --git a/doc/api/cli.md b/doc/api/cli.md index 85ca8c8d8376a2..925af35a6115ed 100644 --- a/doc/api/cli.md +++ b/doc/api/cli.md @@ -1386,25 +1386,6 @@ added: Enable the experimental [`node:stream/iter`][] module. -### `--experimental-test-coverage` - - - -When used in conjunction with the `node:test` module, a code coverage report is -generated as part of the test runner output. If no tests are run, a coverage -report is not generated. See the documentation on -[collecting code coverage from tests][] for more details. - ### `--experimental-test-module-mocks` + +Enable code coverage collection in the test runner. If no tests are run, a +coverage report is not generated. See the documentation on +[collecting code coverage from tests][] for more details. + +The legacy `--experimental-test-coverage` flag is supported as an alias. + ### `--test-coverage-branches=threshold`