refactor: isolate tmux runner implementation
This commit is contained in:
@@ -1,33 +0,0 @@
|
||||
import test from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
import { createTmuxSingleRunner } from "./runner.ts";
|
||||
|
||||
test("createTmuxSingleRunner always kills the pane after monitor completion", async () => {
|
||||
const killed: string[] = [];
|
||||
|
||||
const runSingleTask = createTmuxSingleRunner({
|
||||
assertInsideTmux() {},
|
||||
getCurrentWindowId: async () => "@1",
|
||||
createArtifacts: async () => ({
|
||||
metaPath: "/tmp/meta.json",
|
||||
runId: "run-1",
|
||||
eventsPath: "/tmp/events.jsonl",
|
||||
resultPath: "/tmp/result.json",
|
||||
sessionPath: "/tmp/child-session.jsonl",
|
||||
stdoutPath: "/tmp/stdout.log",
|
||||
stderrPath: "/tmp/stderr.log",
|
||||
}),
|
||||
buildWrapperCommand: () => "'node' '/wrapper.mjs' '/tmp/meta.json'",
|
||||
createPane: async () => "%9",
|
||||
monitorRun: async () => ({ finalText: "done", exitCode: 0 }),
|
||||
killPane: async (paneId: string) => {
|
||||
killed.push(paneId);
|
||||
},
|
||||
});
|
||||
|
||||
const result = await runSingleTask({ cwd: "/repo", meta: { task: "inspect auth" } as any });
|
||||
|
||||
assert.equal(result.paneId, "%9");
|
||||
assert.equal(result.finalText, "done");
|
||||
assert.deepEqual(killed, ["%9"]);
|
||||
});
|
||||
Reference in New Issue
Block a user