Skip to content

Commit

Permalink
Add expandDirectories: false to globSync calls
Browse files Browse the repository at this point in the history
  • Loading branch information
ziebam committed Aug 29, 2024
1 parent d587c7b commit b70a957
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
4 changes: 3 additions & 1 deletion packages/jest-config/src/normalize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
7 changes: 4 additions & 3 deletions packages/jest-reporters/src/CoverageReporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down
4 changes: 3 additions & 1 deletion packages/jest-runtime/src/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit b70a957

Please sign in to comment.