@@ -27,7 +27,7 @@ const {
2727} = require ( 'fs' ) ;
2828const { setupCoverageHooks } = require ( 'internal/util' ) ;
2929const { tmpdir } = require ( 'os' ) ;
30- const { join, resolve, relative, matchesGlob } = require ( 'path' ) ;
30+ const { join, resolve, relative } = require ( 'path' ) ;
3131const { fileURLToPath } = require ( 'internal/url' ) ;
3232const { kMappings, SourceMap } = require ( 'internal/source_map/source_map' ) ;
3333const {
@@ -36,6 +36,8 @@ const {
3636 ERR_SOURCE_MAP_MISSING_SOURCE ,
3737 } ,
3838} = require ( 'internal/errors' ) ;
39+ const { matchGlobPattern } = require ( 'internal/fs/glob' ) ;
40+
3941const kCoverageFileRegex = / ^ c o v e r a g e - ( \d + ) - ( \d { 13 } ) - ( \d + ) \. j s o n $ / ;
4042const 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 + ) ? \* \/ / ;
4143const kLineEndingRegex = / \r ? \n $ / u;
@@ -464,19 +466,24 @@ class TestCoverage {
464466 coverageExcludeGlobs : excludeGlobs ,
465467 coverageIncludeGlobs : includeGlobs ,
466468 } = this . options ;
469+
467470 // This check filters out files that match the exclude globs.
468471 if ( excludeGlobs ?. length > 0 ) {
469472 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 ;
472477 }
473478 }
474479
475480 // This check filters out files that do not match the include globs.
476481 if ( includeGlobs ?. length > 0 ) {
477482 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 ;
480487 }
481488 return true ;
482489 }
0 commit comments