Skip to content

Commit 5d5774b

Browse files
Added window path test
1 parent 970b8a5 commit 5d5774b

1 file changed

Lines changed: 31 additions & 0 deletions

File tree

src/test/parseFilePatterns.test.ts

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,37 @@ suite("parseFilePatterns", () => {
7676
}
7777
});
7878

79+
test("expands Windows-style glob patterns on Windows", async function () {
80+
if (path.sep !== "\\") {
81+
this.skip();
82+
return;
83+
}
84+
85+
const directory = await createTempDirectory();
86+
const cwd = process.cwd();
87+
88+
try {
89+
await fs.mkdir(path.join(directory, "nested"));
90+
await fs.writeFile(path.join(directory, "one.txt"), "one", "utf8");
91+
await fs.writeFile(
92+
path.join(directory, "nested", "two.txt"),
93+
"two",
94+
"utf8",
95+
);
96+
process.chdir(directory);
97+
98+
const files = await parseFilePatterns(createCLI(), ["**\\*.txt"]);
99+
100+
assert.deepEqual(files, [
101+
path.join(directory, "nested", "two.txt"),
102+
path.join(directory, "one.txt"),
103+
]);
104+
} finally {
105+
process.chdir(cwd);
106+
await cleanupDirectory(directory);
107+
}
108+
});
109+
79110
test("deduplicates overlapping patterns", async () => {
80111
const directory = await createTempDirectory();
81112
const cwd = process.cwd();

0 commit comments

Comments
 (0)