fix walkDir tests on windows
This commit is contained in:
parent
be035fd2a9
commit
66d1b7981b
2 changed files with 12 additions and 5 deletions
|
|
@ -220,12 +220,12 @@ export async function walkDir(
|
|||
for await (const e of dfsWalker.walk()) {
|
||||
relativePaths.push(e);
|
||||
}
|
||||
if (options?.returnRelativePaths) {
|
||||
return relativePaths;
|
||||
}
|
||||
|
||||
const pathSep = await ide.pathSep();
|
||||
const prefix = options.returnRelativePaths ? "" : (path + pathSep);
|
||||
|
||||
if (pathSep === "/") {
|
||||
return relativePaths.map((p) => path + pathSep + p);
|
||||
return relativePaths.map((p) => prefix + p);
|
||||
}
|
||||
return relativePaths.map((p) => path + pathSep + p.split("/").join(pathSep));
|
||||
return relativePaths.map((p) => prefix + p.split("/").join(pathSep));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,6 +24,13 @@ async function expectPaths(
|
|||
toNotExist: string[],
|
||||
options?: WalkerOptions,
|
||||
) {
|
||||
// Convert to Windows paths
|
||||
const pathSep = await ide.pathSep();
|
||||
if (pathSep === "\\") {
|
||||
toExist = toExist.map((p) => p.replace(/\//g, "\\"));
|
||||
toNotExist = toNotExist.map((p) => p.replace(/\//g, "\\"));
|
||||
}
|
||||
|
||||
const result = await walkTestDir(options);
|
||||
|
||||
for (const p of toExist) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue