Skip to content

Commit cdcbb45

Browse files
test: ensure fixture clean up is resilient to missing files
1 parent 4c7849e commit cdcbb45

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

packages/wrangler/src/__tests__/index.test.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import * as path from "node:path";
44
import * as TOML from "@iarna/toml";
55
import { main } from "../index";
66
import { setMock, unsetAllMocks } from "./mock-cfetch";
7+
import { existsSync } from "node:fs";
78

89
jest.mock("../cfetch", () => jest.requireActual("./mock-cfetch"));
910

@@ -99,7 +100,9 @@ describe("wrangler", () => {
99100
});
100101

101102
afterEach(async () => {
102-
await fsp.rm("./wrangler.toml");
103+
if (existsSync("./wrangler.toml")) {
104+
await fsp.rm("./wrangler.toml");
105+
}
103106
process.chdir(ogcwd);
104107
});
105108

0 commit comments

Comments
 (0)