























@@ -2,7 +2,7 @@ import { EventEmitter } from "node:events";
22import fs from "node:fs";
33import os from "node:os";
44import path from "node:path";
5-import { describe, expect, it } from "vitest";
5+import { afterEach, describe, expect, it } from "vitest";
66import {
77buildBlacksmithRunArgs,
88resolveTestboxSyncTimeoutMs,
@@ -11,6 +11,14 @@ import {
1111} from "../../scripts/blacksmith-testbox-runner.mjs";
12121313describe("blacksmith testbox runner", () => {
14+const tempDirs: string[] = [];
15+16+afterEach(() => {
17+for (const dir of tempDirs.splice(0)) {
18+fs.rmSync(dir, { recursive: true, force: true });
19+}
20+});
21+1422it("splits runner args from the remote command", () => {
1523expect(
1624splitRunnerArgs(["--id", "tbx_abc123", "--", "OPENCLAW_TESTBOX=1", "pnpm", "check:changed"]),
@@ -48,6 +56,7 @@ describe("blacksmith testbox runner", () => {
48564957it("refuses to run a keyed id that was not claimed by this checkout", async () => {
5058const stateDir = fs.mkdtempSync(path.join(os.tmpdir(), "openclaw-testbox-runner-"));
59+tempDirs.push(stateDir);
5160const testboxDir = path.join(stateDir, "tbx_01kqap50t9fqggzw1akg5dtmmq");
5261fs.mkdirSync(testboxDir, { recursive: true });
5362fs.writeFileSync(path.join(testboxDir, "id_ed25519"), "test-key\n");
@@ -71,6 +80,7 @@ describe("blacksmith testbox runner", () => {
71807281it("claims a keyed id without spawning when no remote command is supplied", async () => {
7382const stateDir = fs.mkdtempSync(path.join(os.tmpdir(), "openclaw-testbox-runner-"));
83+tempDirs.push(stateDir);
7484const testboxDir = path.join(stateDir, "tbx_01kqap50t9fqggzw1akg5dtmmq");
7585const claimPath = path.join(testboxDir, "openclaw-runner.json");
7686fs.mkdirSync(testboxDir, { recursive: true });
@@ -102,6 +112,7 @@ describe("blacksmith testbox runner", () => {
102112103113it("terminates a Testbox run that stalls in sync", async () => {
104114const stateDir = fs.mkdtempSync(path.join(os.tmpdir(), "openclaw-testbox-runner-"));
115+tempDirs.push(stateDir);
105116const testboxId = "tbx_01kqap50t9fqggzw1akg5dtmmq";
106117const testboxDir = path.join(stateDir, testboxId);
107118fs.mkdirSync(testboxDir, { recursive: true });
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。