From bd1a09b2e37b996bc493178b185abf06e8ff5502 Mon Sep 17 00:00:00 2001 From: Matteo Collina Date: Sat, 23 May 2026 13:59:13 +0200 Subject: [PATCH 1/2] 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 | 1 + 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, 85 insertions(+), 68 deletions(-) diff --git a/doc/api/cli.md b/doc/api/cli.md index 7230231decd4..c601da0c928b 100644 --- a/doc/api/cli.md +++ b/doc/api/cli.md @@ -1666,25 +1666,6 @@ is highly discouraged. Stripping types inside `node_modules` is intended only for local development. -### `--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`