From 88f237ccd7e39a40ac4fea5fc362fb9d4436ada3 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 | 9 +++--- doc/api/test.md | 10 +++--- doc/node-config-schema.json | 8 +++++ doc/node.1 | 10 +++--- 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, 65 insertions(+), 52 deletions(-) diff --git a/doc/api/cli.md b/doc/api/cli.md index bc1f69483f3f7f..f994d8eead79bd 100644 --- a/doc/api/cli.md +++ b/doc/api/cli.md @@ -1386,7 +1386,7 @@ added: Enable the experimental [`node:stream/iter`][] module. -### `--experimental-test-coverage` +### `--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 +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. + ### `--experimental-test-module-mocks`