diff --git a/src/process/exec.test.ts b/src/process/exec.test.ts index 72b1b683ece..c8d1128940d 100644 --- a/src/process/exec.test.ts +++ b/src/process/exec.test.ts @@ -38,9 +38,9 @@ describe("runCommandWithTimeout", () => { it("kills command when no output timeout elapses", async () => { const result = await runCommandWithTimeout( - [process.execPath, "-e", "setTimeout(() => {}, 30)"], + [process.execPath, "-e", "setTimeout(() => {}, 20)"], { - timeoutMs: 220, + timeoutMs: 180, noOutputTimeoutMs: 8, }, ); @@ -60,15 +60,15 @@ describe("runCommandWithTimeout", () => { "let count = 0;", 'const ticker = setInterval(() => { process.stdout.write(".");', "count += 1;", - "if (count === 3) {", + "if (count === 2) {", "clearInterval(ticker);", "process.exit(0);", "}", - "}, 6);", + "}, 5);", ].join(" "), ], { - timeoutMs: 600, + timeoutMs: 400, // Keep a healthy margin above the emit interval while avoiding long idle waits. noOutputTimeoutMs: 60, }, @@ -77,14 +77,14 @@ describe("runCommandWithTimeout", () => { expect(result.code ?? 0).toBe(0); expect(result.termination).toBe("exit"); expect(result.noOutputTimedOut).toBe(false); - expect(result.stdout.length).toBeGreaterThanOrEqual(4); + expect(result.stdout.length).toBeGreaterThanOrEqual(3); }); it("reports global timeout termination when overall timeout elapses", async () => { const result = await runCommandWithTimeout( - [process.execPath, "-e", "setTimeout(() => {}, 20)"], + [process.execPath, "-e", "setTimeout(() => {}, 12)"], { - timeoutMs: 10, + timeoutMs: 8, }, ); diff --git a/src/process/supervisor/supervisor.test.ts b/src/process/supervisor/supervisor.test.ts index 6b886cef9b0..c2317e8d39f 100644 --- a/src/process/supervisor/supervisor.test.ts +++ b/src/process/supervisor/supervisor.test.ts @@ -4,7 +4,7 @@ import { createProcessSupervisor } from "./supervisor.js"; type ProcessSupervisor = ReturnType; type SpawnOptions = Parameters[0]; type ChildSpawnOptions = Omit, "backendId" | "mode">; -const OUTPUT_DELAY_MS = 6; +const OUTPUT_DELAY_MS = 3; async function spawnChild(supervisor: ProcessSupervisor, options: ChildSpawnOptions) { return supervisor.spawn({ @@ -38,9 +38,9 @@ describe("process supervisor", () => { const supervisor = createProcessSupervisor(); const run = await spawnChild(supervisor, { sessionId: "s1", - argv: [process.execPath, "-e", "setTimeout(() => {}, 18)"], + argv: [process.execPath, "-e", "setTimeout(() => {}, 14)"], timeoutMs: 300, - noOutputTimeoutMs: 6, + noOutputTimeoutMs: 5, stdinMode: "pipe-closed", }); const exit = await run.wait(); @@ -54,7 +54,7 @@ describe("process supervisor", () => { const first = await spawnChild(supervisor, { sessionId: "s1", scopeKey: "scope:a", - argv: [process.execPath, "-e", "setTimeout(() => {}, 120)"], + argv: [process.execPath, "-e", "setTimeout(() => {}, 80)"], timeoutMs: 1_000, stdinMode: "pipe-open", }); @@ -84,7 +84,7 @@ describe("process supervisor", () => { const supervisor = createProcessSupervisor(); const run = await spawnChild(supervisor, { sessionId: "s-timeout", - argv: [process.execPath, "-e", "setTimeout(() => {}, 20)"], + argv: [process.execPath, "-e", "setTimeout(() => {}, 12)"], timeoutMs: 1, stdinMode: "pipe-closed", });