test_runner: match dotfiles in default coverage exclude#63401
Open
semimikoh wants to merge 1 commit into
Open
Conversation
The default coverage exclude patterns ... (본문) Fixes: nodejs#63397 Signed-off-by: semimikoh <ejffjeosms@gmail.com>
Collaborator
|
Review requested:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The default coverage exclude patterns ... (본문)
Fixes: #63397
Problem
node --experimental-test-coverageincludes dotfile test files (e.g.test/.foo.cjs) in the coverage report even though the default exclude patterns are intended to drop everything undertest/. Non-dotfile siblings are correctly excluded.This is caused by
matchGlobPatterncalling minimatch withoutdot: true; minimatch's default behavior is to not match dot-prefixed entries unless the pattern itself starts with a dot.Reported in #63397.
Fix
lib/internal/fs/glob.js: extendmatchGlobPatternwith an optionaloptionsargument forwarded to minimatch. Fixed options (nocase,windowsPathsNoEscape, etc.) still take precedence so callers cannot accidentally override them.lib/internal/test_runner/coverage.js: route the four exclude/include match calls through a small helper that passes{ dot: true }. Applied to both exclude and include for consistency.Test
Added a new scenario to
test-runner-coverage-default-exclusion.mjsthat runstest/.dotfile.cjsexplicitly and asserts the dotfile does not appear in the coverage report under the default exclude patterns. The new fixturetest/.dotfile.cjsexercises the samelogic-file.jsas the existing fixtures.Fixes: #63397