node
node copied to clipboard
test_runner: exclude test files from coverage by default
This should address #53508.
I'm opening this PR since #55633 seems to be stale.
This PR contains the feature and some changes to reduce its footprint.
Note: The reason behind lazyMinimatch
is to avoid experimental warnings related to matchesGlob
.
I'm not entirely convinced about the change I introduced to the --test-coverage-exclude
and --test-coverage-include
flags.
Regarding: @cjihrig https://github.com/nodejs/node/pull/55633#pullrequestreview-2410163982
Another thing that is not clear to me: what happens if someone runs a test file, but that test file imports another file that also includes tests? Should we exclude that imported file from the coverage report, or should we only exclude the files that the user specified?
I think we should just exclude the files specified by the user, as it's the most common scenario. If a user imports other tests from different files, I would expect them to exclude those manually. WDYT?