From cc09908ca5343ef7af1a8e51d9d8fb74fefb647c Mon Sep 17 00:00:00 2001 From: Llorx Date: Sat, 2 Nov 2024 09:39:48 +0100 Subject: [PATCH] test_runner: exclude test files from code coverage by default Is not usual to test the code coverage of test files. Fixes: https://github.com/nodejs/node/issues/53508 --- doc/api/cli.md | 3 ++ doc/api/test.md | 2 + lib/internal/test_runner/coverage.js | 6 ++- lib/internal/test_runner/runner.js | 3 +- .../test-runner-coverage-source-map.js | 1 + .../test-runner-coverage-thresholds.js | 12 +++++ test/parallel/test-runner-coverage.js | 53 +++++++++++++++---- test/parallel/test-runner-run-coverage.mjs | 45 ++++++++++++++-- 8 files changed, 106 insertions(+), 19 deletions(-) diff --git a/doc/api/cli.md b/doc/api/cli.md index eeb7f25f4f82d9..a3c62d072ac0d0 100644 --- a/doc/api/cli.md +++ b/doc/api/cli.md @@ -2352,6 +2352,9 @@ 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. +By default, the files being tested are excluded from code coverage. They can be explicitly +included via this flag. + ### `--test-coverage-lines=threshold`