diff --git a/server/__tests__/lanes-api.test.js b/server/__tests__/lanes-api.test.js index b3cc58d8..740c1301 100644 --- a/server/__tests__/lanes-api.test.js +++ b/server/__tests__/lanes-api.test.js @@ -934,13 +934,14 @@ describe("GET /:id/ci/status", () => { let laneId; let laneCwd; let restorePath; + let bin; before(async () => { laneCwd = fs.mkdtempSync(path.join(os.tmpdir(), "ccam-ci-status-route-")); const r = await request("POST", "/api/lanes", { title: "CI status lane", cwd: laneCwd }); laneId = r.body.lane.id; - const bin = fs.mkdtempSync(path.join(os.tmpdir(), "ccam-ci-status-bin-")); + bin = fs.mkdtempSync(path.join(os.tmpdir(), "ccam-ci-status-bin-")); fs.writeFileSync( path.join(bin, "gh"), `#!/usr/bin/env bash @@ -966,6 +967,7 @@ exit 1 after(() => { if (restorePath) restorePath(); fs.rmSync(laneCwd, { recursive: true, force: true }); + fs.rmSync(bin, { recursive: true, force: true }); }); it("404s for an unknown lane", async () => { diff --git a/server/__tests__/lanes-cli.test.js b/server/__tests__/lanes-cli.test.js index bb592a81..fe9f8c46 100644 --- a/server/__tests__/lanes-cli.test.js +++ b/server/__tests__/lanes-cli.test.js @@ -545,9 +545,10 @@ describe("ccam lanes — inferred stage detection", () => { describe("ccam lanes ci status", () => { let restorePath; + let bin; before(() => { - const bin = fs.mkdtempSync(path.join(os.tmpdir(), "ccam-ci-status-cli-bin-")); + bin = fs.mkdtempSync(path.join(os.tmpdir(), "ccam-ci-status-cli-bin-")); fs.writeFileSync( path.join(bin, "gh"), `#!/usr/bin/env bash @@ -580,7 +581,10 @@ exit 1 }; }); - after(() => restorePath && restorePath()); + after(() => { + if (restorePath) restorePath(); + fs.rmSync(bin, { recursive: true, force: true }); + }); it("exits 0 and prints success state", async () => { const r = await cli(["lanes", "ci", "status", "development"], LANE_DIR);