From 2f5a65101a2d3ce9793a2924e42b81f4b5fdfeaa Mon Sep 17 00:00:00 2001 From: avivkeller Date: Wed, 29 Jul 2026 14:17:04 -0700 Subject: [PATCH 1/2] test_runner: add support for --test-coverage-include-all Signed-off-by: avivkeller --- doc/api/cli.md | 16 +++++ doc/api/test.md | 7 ++ doc/node.1 | 9 +++ lib/internal/test_runner/coverage.js | 50 ++++++++++++- lib/internal/test_runner/runner.js | 3 + lib/internal/test_runner/utils.js | 2 + src/node_options.cc | 7 ++ src/node_options.h | 1 + .../coverage-include-all/covered.js | 5 ++ .../coverage-include-all/data.json | 3 + .../coverage-include-all/index.test.js | 9 +++ .../coverage-include-all/nested/deep.js | 5 ++ .../node_modules/pkg/index.js | 5 ++ .../coverage-include-all/untested.js | 5 ++ test/parallel/test-runner-coverage.js | 70 +++++++++++++++++++ 15 files changed, 196 insertions(+), 1 deletion(-) create mode 100644 test/fixtures/test-runner/coverage-include-all/covered.js create mode 100644 test/fixtures/test-runner/coverage-include-all/data.json create mode 100644 test/fixtures/test-runner/coverage-include-all/index.test.js create mode 100644 test/fixtures/test-runner/coverage-include-all/nested/deep.js create mode 100644 test/fixtures/test-runner/coverage-include-all/node_modules/pkg/index.js create mode 100644 test/fixtures/test-runner/coverage-include-all/untested.js diff --git a/doc/api/cli.md b/doc/api/cli.md index 5d59844d4cbc72..241892524ef500 100644 --- a/doc/api/cli.md +++ b/doc/api/cli.md @@ -2857,6 +2857,21 @@ This option may be specified multiple times to include multiple glob patterns. If both `--test-coverage-exclude` and `--test-coverage-include` are provided, files must meet **both** criteria to be included in the coverage report. +### `--test-coverage-include-all` + + + +> Stability: 1 - Experimental + +Includes source files that were never loaded by the test run in the coverage +report, where they are reported as having zero coverage. + +Candidate files are searched for in the current working directory, and are +subject to the same `--test-coverage-include` and `--test-coverage-exclude` +filtering as the rest of the report. + ### `--test-coverage-lines=threshold`