@@ -27,7 +27,7 @@ const {
27
27
} = require ( 'fs' ) ;
28
28
const { setupCoverageHooks } = require ( 'internal/util' ) ;
29
29
const { tmpdir } = require ( 'os' ) ;
30
- const { join, resolve, relative, matchesGlob } = require ( 'path' ) ;
30
+ const { join, resolve, relative } = require ( 'path' ) ;
31
31
const { fileURLToPath } = require ( 'internal/url' ) ;
32
32
const { kMappings, SourceMap } = require ( 'internal/source_map/source_map' ) ;
33
33
const {
@@ -36,6 +36,8 @@ const {
36
36
ERR_SOURCE_MAP_MISSING_SOURCE ,
37
37
} ,
38
38
} = require ( 'internal/errors' ) ;
39
+ const { matchGlobPattern } = require ( 'internal/fs/glob' ) ;
40
+
39
41
const kCoverageFileRegex = / ^ c o v e r a g e - ( \d + ) - ( \d { 13 } ) - ( \d + ) \. j s o n $ / ;
40
42
const kIgnoreRegex = / \/ \* n o d e : c o v e r a g e i g n o r e n e x t (?< count > \d + ) ? \* \/ / ;
41
43
const kLineEndingRegex = / \r ? \n $ / u;
@@ -464,19 +466,24 @@ class TestCoverage {
464
466
coverageExcludeGlobs : excludeGlobs ,
465
467
coverageIncludeGlobs : includeGlobs ,
466
468
} = this . options ;
469
+
467
470
// This check filters out files that match the exclude globs.
468
471
if ( excludeGlobs ?. length > 0 ) {
469
472
for ( let i = 0 ; i < excludeGlobs . length ; ++ i ) {
470
- if ( matchesGlob ( relativePath , excludeGlobs [ i ] ) ||
471
- matchesGlob ( absolutePath , excludeGlobs [ i ] ) ) return true ;
473
+ if (
474
+ matchGlobPattern ( relativePath , excludeGlobs [ i ] ) ||
475
+ matchGlobPattern ( absolutePath , excludeGlobs [ i ] )
476
+ ) return true ;
472
477
}
473
478
}
474
479
475
480
// This check filters out files that do not match the include globs.
476
481
if ( includeGlobs ?. length > 0 ) {
477
482
for ( let i = 0 ; i < includeGlobs . length ; ++ i ) {
478
- if ( matchesGlob ( relativePath , includeGlobs [ i ] ) ||
479
- matchesGlob ( absolutePath , includeGlobs [ i ] ) ) return false ;
483
+ if (
484
+ matchGlobPattern ( relativePath , includeGlobs [ i ] ) ||
485
+ matchGlobPattern ( absolutePath , includeGlobs [ i ] )
486
+ ) return false ;
480
487
}
481
488
return true ;
482
489
}
0 commit comments