feat: P2 operator, preprocessing state/service, and runtime config lease
This commit is contained in:
@@ -10,18 +10,22 @@ import { ThtRunner } from "../src/tht/tht-runner.js";
|
||||
|
||||
// Spy on child_process.spawn so we can capture the resolved argv (incl. -c config)
|
||||
// that ThtRunner.run() builds, without launching a real process.
|
||||
vi.mock("node:child_process", () => ({
|
||||
spawn: vi.fn(() => {
|
||||
const ch: any = new EventEmitter();
|
||||
ch.stdout = new EventEmitter();
|
||||
ch.stderr = new EventEmitter();
|
||||
queueMicrotask(() => {
|
||||
ch.stdout.emit("data", Buffer.from('{"id":"x"}'));
|
||||
ch.emit("close", 0);
|
||||
});
|
||||
return ch;
|
||||
}),
|
||||
}));
|
||||
vi.mock("node:child_process", async (importOriginal) => {
|
||||
const actual = await importOriginal<typeof import("node:child_process")>();
|
||||
return {
|
||||
...actual,
|
||||
spawn: vi.fn(() => {
|
||||
const ch: any = new EventEmitter();
|
||||
ch.stdout = new EventEmitter();
|
||||
ch.stderr = new EventEmitter();
|
||||
queueMicrotask(() => {
|
||||
ch.stdout.emit("data", Buffer.from('{"id":"x"}'));
|
||||
ch.emit("close", 0);
|
||||
});
|
||||
return ch;
|
||||
}),
|
||||
};
|
||||
});
|
||||
import { spawn } from "node:child_process";
|
||||
|
||||
test("sessionNew parses id from JSON", async () => {
|
||||
|
||||
Reference in New Issue
Block a user