test(runtime): trim timer-heavy regression suites

This commit is contained in:
Peter Steinberger
2026-03-02 09:45:57 +00:00
parent fd4d157e45
commit 04030ddf68
4 changed files with 27 additions and 50 deletions

View File

@@ -6,8 +6,8 @@ import { withEnvAsync } from "../test-utils/env.js";
import { attachChildProcessBridge } from "./child-process-bridge.js";
import { runCommandWithTimeout, shouldSpawnWithShell } from "./exec.js";
const CHILD_READY_TIMEOUT_MS = 4_000;
const CHILD_EXIT_TIMEOUT_MS = 4_000;
const CHILD_READY_TIMEOUT_MS = 2_000;
const CHILD_EXIT_TIMEOUT_MS = 2_000;
function waitForLine(
stream: NodeJS.ReadableStream,
@@ -79,10 +79,10 @@ describe("runCommandWithTimeout", () => {
it("kills command when no output timeout elapses", async () => {
const result = await runCommandWithTimeout(
[process.execPath, "-e", "setTimeout(() => {}, 40)"],
[process.execPath, "-e", "setTimeout(() => {}, 80)"],
{
timeoutMs: 500,
noOutputTimeoutMs: 20,
noOutputTimeoutMs: 25,
},
);
@@ -101,24 +101,24 @@ describe("runCommandWithTimeout", () => {
"let count = 0;",
'const ticker = setInterval(() => { process.stdout.write(".");',
"count += 1;",
"if (count === 6) {",
"if (count === 3) {",
"clearInterval(ticker);",
"process.exit(0);",
"}",
"}, 25);",
"}, 15);",
].join(" "),
],
{
timeoutMs: 3_000,
// Keep a healthy margin above the emit interval while avoiding a 1s+ test delay.
noOutputTimeoutMs: 400,
// Keep a healthy margin above the emit interval while avoiding long idle waits.
noOutputTimeoutMs: 120,
},
);
expect(result.code ?? 0).toBe(0);
expect(result.termination).toBe("exit");
expect(result.noOutputTimedOut).toBe(false);
expect(result.stdout.length).toBeGreaterThanOrEqual(7);
expect(result.stdout.length).toBeGreaterThanOrEqual(4);
});
it("reports global timeout termination when overall timeout elapses", async () => {