Skip to content

Commit d525471

Browse files
committed
test(core): make compress path coverage test cross-platform
1 parent 1267661 commit d525471

1 file changed

Lines changed: 2 additions & 6 deletions

File tree

packages/core/__tests__/compress-paths.test.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ describe("compress path handling", () => {
2525
});
2626

2727
test("should create directory for output paths using backslashes", async () => {
28-
vi.spyOn(path, "dirname").mockReturnValue("nested\\dir");
29-
3028
const compressor: Compressor = async () => ({ code: "ok" });
3129
const settings: Settings = {
3230
compressor,
@@ -42,9 +40,8 @@ describe("compress path handling", () => {
4240
expect(vi.mocked(compressSingleFile)).toHaveBeenCalledTimes(1);
4341
});
4442

45-
test("should fallback to win32 dirname when platform dirname returns dot", async () => {
46-
vi.spyOn(path, "dirname").mockReturnValue(".");
47-
const win32DirnameSpy = vi.spyOn(path.win32, "dirname");
43+
test("should normalize dirname output before mkdir", async () => {
44+
vi.spyOn(path, "dirname").mockReturnValue("nested\\dir");
4845

4946
const compressor: Compressor = async () => ({ code: "ok" });
5047
const settings: Settings = {
@@ -55,7 +52,6 @@ describe("compress path handling", () => {
5552

5653
await compress(settings);
5754

58-
expect(win32DirnameSpy).toHaveBeenCalledWith("nested\\dir\\file.min.js");
5955
expect(vi.mocked(mkdir)).toHaveBeenCalledWith("nested/dir", {
6056
recursive: true,
6157
});

0 commit comments

Comments
 (0)