diff --git a/src/adapter/scriptSkipper/simpleGlobToRe.test.ts b/src/adapter/scriptSkipper/simpleGlobToRe.test.ts index fee89847d..07c607306 100644 --- a/src/adapter/scriptSkipper/simpleGlobToRe.test.ts +++ b/src/adapter/scriptSkipper/simpleGlobToRe.test.ts @@ -46,6 +46,22 @@ describe('simpleGlobsToRe', () => { 'file:///hello/foo/bin/filename.js': false, }, }, + { + globs: ['**/foo/**/*.js'], + matches: { + 'file:///hello/foo/bar.js': true, + 'file:///hello/foo/bin/bar.js': true, + 'file:///hello/foobar.js': false, + }, + }, + { + globs: ['**/foo/**', '!**/foo/**/bar/**'], + matches: { + 'file:///hello/foo/bin/baz': true, + 'file:///hello/foo/bar/baz': false, + 'file:///hello/foo/bin/bar/baz': false, + }, + }, ]; for (const { globs, matches } of truthTable) { diff --git a/src/adapter/scriptSkipper/simpleGlobToRe.ts b/src/adapter/scriptSkipper/simpleGlobToRe.ts index 89f505295..5a0c89d74 100644 --- a/src/adapter/scriptSkipper/simpleGlobToRe.ts +++ b/src/adapter/scriptSkipper/simpleGlobToRe.ts @@ -48,7 +48,7 @@ function globToRe(glob: string, processPart = escapeRegexSpecialChars) { } else if (j === parts.length - 1) { // nothing more needed! } else { - regexParts.push('.*/'); + regexParts.push('(.*/)?'); // zero or more directories } } else { if (p.includes('*')) {