test: speed up long-running async suites

This commit is contained in:
Peter Steinberger
2026-02-23 05:03:15 +00:00
parent 48f327c206
commit 610863e733
2 changed files with 30 additions and 29 deletions

View File

@@ -8,11 +8,11 @@ import { createExecTool } from "./bash-tools.exec.js";
import { killProcessTree } from "./shell-utils.js";
const BACKGROUND_HOLD_CMD = 'node -e "setTimeout(() => {}, 5000)"';
const ABORT_SETTLE_MS = process.platform === "win32" ? 200 : 40;
const ABORT_SETTLE_MS = process.platform === "win32" ? 200 : 25;
const ABORT_WAIT_TIMEOUT_MS = process.platform === "win32" ? 1_500 : 240;
const POLL_INTERVAL_MS = 15;
const FINISHED_WAIT_TIMEOUT_MS = process.platform === "win32" ? 8_000 : 600;
const BACKGROUND_TIMEOUT_SEC = process.platform === "win32" ? 0.2 : 0.08;
const BACKGROUND_TIMEOUT_SEC = process.platform === "win32" ? 0.2 : 0.05;
const TEST_EXEC_DEFAULTS = {
security: "full" as const,
ask: "off" as const,
@@ -151,7 +151,7 @@ test("background exec without explicit timeout ignores default timeout", async (
const result = await tool.execute("toolcall", { command: BACKGROUND_HOLD_CMD, background: true });
expect(result.details.status).toBe("running");
const sessionId = (result.details as { sessionId: string }).sessionId;
const waitMs = Math.max(ABORT_SETTLE_MS + 120, BACKGROUND_TIMEOUT_SEC * 1000 + 120);
const waitMs = Math.max(ABORT_SETTLE_MS + 80, BACKGROUND_TIMEOUT_SEC * 1000 + 80);
const startedAt = Date.now();
await expect