Add windowsPathsNoEscape to glob calls that may receive backslash paths

Glob v13 treats backslashes as escape characters by default, unlike v7
which treated them as path separators on Windows. This broke Windows CI
where path.join/resolve produce backslash paths.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Fredrik Adelöw <freben@spotify.com>
This commit is contained in:
Fredrik Adelöw
2026-03-31 15:20:56 +02:00
parent 2e5c5f85b2
commit b6c0ef5d5d
4 changed files with 11 additions and 3 deletions
@@ -25,7 +25,10 @@ export function resolveEntryPath(
targetDir: string,
): string {
const { dir: entryDir, name: entryName } = parse(entrypoint);
const [entryFile] = glob.sync(`${resolve(targetDir, entryDir, entryName)}.*`);
const [entryFile] = glob.sync(
`${resolve(targetDir, entryDir, entryName)}.*`,
{ windowsPathsNoEscape: true },
);
if (entryFile) {
return join(entryDir, entryName);
}
+3 -1
View File
@@ -367,7 +367,9 @@ async function getRootConfig() {
// workspace and load those in as separate jest projects instead.
const projectPaths = await Promise.all(
workspacePatterns.map(pattern =>
glob(path.join(paths.targetRoot, pattern)),
glob(path.join(paths.targetRoot, pattern), {
windowsPathsNoEscape: true,
}),
),
).then(_ => _.flat());
@@ -119,6 +119,7 @@ export default async function packageDocs(paths: string[] = [], opts: any) {
const existingDocsJsonPaths = glob.sync(
targetPaths.resolveRoot('dist-types/**/docs.json'),
{ windowsPathsNoEscape: true },
);
if (existingDocsJsonPaths.length > 0) {
console.warn(
@@ -44,7 +44,9 @@ export class FileReaderProcessor implements CatalogProcessor {
}
try {
const fileMatches = await glob(location.target);
const fileMatches = await glob(location.target, {
windowsPathsNoEscape: true,
});
if (fileMatches.length > 0) {
for (const fileMatch of fileMatches) {