test(lanes): clean up fake-gh bin tmpdirs after ci/status tests
This commit is contained in:
@@ -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 () => {
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user