test_runner: match dotfiles in default coverage exclude#63401
Open
semimikoh wants to merge 1 commit into
Open
Conversation
Collaborator
|
Review requested:
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #63401 +/- ##
==========================================
+ Coverage 90.23% 90.25% +0.02%
==========================================
Files 741 741
Lines 241194 241210 +16
Branches 45432 45430 -2
==========================================
+ Hits 217640 217704 +64
+ Misses 15129 15080 -49
- Partials 8425 8426 +1
🚀 New features to boost your workflow:
|
avivkeller
reviewed
May 18, 2026
| // TODO(pmarchini): this default should follow something similar to c8 defaults | ||
| // Default exclusions should be also exported to be used by other tools / users | ||
| coverageExcludeGlobs = [kDefaultPattern]; | ||
| coverageExcludeGlobs = [kDefaultPattern, kDefaultCoverageDotfilePattern]; |
Member
There was a problem hiding this comment.
Can't we just set dot: true?
Contributor
Author
There was a problem hiding this comment.
Good catch — reverted to the dot: true approach (which the PR body originally described). Pushed as a follow-up fixup. This also makes user-supplied --test-coverage-exclude globs match dotfiles, which the extra default pattern wouldn't have covered.
d807464 to
b0e1f2c
Compare
31 tasks
The default coverage exclude globs did not match dotfiles, so test files such as `test/.foo.test.js` were incorrectly included in coverage reports. Apply the `dot: true` minimatch option when matching the relative path so the default exclude patterns cover dotfiles, while keeping plain matching for the absolute path to avoid misinterpreting dot segments in the filesystem path (e.g. tmp dirs like `test/.tmp.0`). Fixes: nodejs#63397 Signed-off-by: semimikoh <ejffjeosms@gmail.com>
b0e1f2c to
8437db0
Compare
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