test(lanes): clean up fake-gh bin tmpdirs after ci/status tests

This commit is contained in:
2026-08-25 09:59:29 +07:00
parent 90a07debb5
commit 928512b749
2 changed files with 9 additions and 3 deletions
+3 -1
View File
@@ -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 () => {
+6 -2
View File
@@ -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);