diff --git a/packages/jest-config/src/normalize.ts b/packages/jest-config/src/normalize.ts index 7ca05620bf06..bb695cb895ad 100644 --- a/packages/jest-config/src/normalize.ts +++ b/packages/jest-config/src/normalize.ts @@ -752,7 +752,9 @@ export default async function normalize( // for the future resolution. const globMatches = typeof project === 'string' - ? globSync([project.replaceAll('\\', '/')]) + ? globSync([project.replaceAll('\\', '/')], { + expandDirectories: false, + }) : []; const projectEntry = globMatches.length > 0 ? globMatches : project; diff --git a/packages/jest-reporters/src/CoverageReporter.ts b/packages/jest-reporters/src/CoverageReporter.ts index 264c650aa2a7..1408f4761820 100644 --- a/packages/jest-reporters/src/CoverageReporter.ts +++ b/packages/jest-reporters/src/CoverageReporter.ts @@ -297,9 +297,10 @@ export default class CoverageReporter extends BaseReporter { // (rather than recalculating it for each covered file) we save a tonne // of execution time. if (filesByGlob[absoluteThresholdGroup] === undefined) { - filesByGlob[absoluteThresholdGroup] = globSync([ - absoluteThresholdGroup.replaceAll('\\', '/'), - ]).map(filePath => path.resolve(filePath)); + filesByGlob[absoluteThresholdGroup] = globSync( + [absoluteThresholdGroup.replaceAll('\\', '/')], + {expandDirectories: false}, + ).map(filePath => path.resolve(filePath)); } if (filesByGlob[absoluteThresholdGroup].includes(file)) { diff --git a/packages/jest-runtime/src/helpers.ts b/packages/jest-runtime/src/helpers.ts index a95bc43f50ee..a34468f87558 100644 --- a/packages/jest-runtime/src/helpers.ts +++ b/packages/jest-runtime/src/helpers.ts @@ -41,7 +41,9 @@ export const findSiblingsWithFileExtension = ( try { const slashedDirname = slash(dirname); - const matches = globSync([`${pathToModule}.*`.replaceAll('\\', '/')]) + const matches = globSync([`${pathToModule}.*`.replaceAll('\\', '/')], { + expandDirectories: false, + }) .map(match => slash(match)) .map(match => { const relativePath = path.posix.relative(slashedDirname, match);