diff --git a/src/exec.test.ts b/src/exec.test.ts index 1a1e9f7..32f4940 100644 --- a/src/exec.test.ts +++ b/src/exec.test.ts @@ -139,7 +139,7 @@ describe("runCommandArgs", () => { } }); - it("returns after timeout even when descendants inherit stdio", async () => { + it("returns after timeout even when descendants inherit stdio", { timeout: 10_000 }, async () => { const dir = await mkdtemp(join(tmpdir(), "clawpatch-exec-timeout-")); const childScript = join(dir, "child.mjs"); const parentScript = join(dir, "parent.mjs"); @@ -160,8 +160,9 @@ describe("runCommandArgs", () => { }); expect(result.exitCode).toBe(124); - expect(result.durationMs).toBeLessThan(1500); - expect(Date.now() - started).toBeLessThan(1500); + // Allow shared-host scheduling headroom while still catching delayed pipe teardown. + expect(result.durationMs).toBeLessThan(5_000); + expect(Date.now() - started).toBeLessThan(5_000); expect(result.stderr).toContain("command timed out after 50ms"); }); diff --git a/src/open-pr.test.ts b/src/open-pr.test.ts index 95aacda..3501f49 100644 --- a/src/open-pr.test.ts +++ b/src/open-pr.test.ts @@ -8,8 +8,10 @@ import { statePaths, writePatchAttempt } from "./state.js"; import { fixtureRoot, testOptions, writeFixture } from "./test-helpers.js"; import type { PatchAttempt } from "./types.js"; -const HANG_TEST_TIMEOUT_MS = 4_000; +const HANG_TEST_TIMEOUT_MS = 15_000; const SHORT_TIMEOUT_MS = 80; +// Real git subprocesses need scheduling headroom on shared CI hosts. +const RETURN_TIMEOUT_MS = 5_000; describe("open-pr command timeouts", () => { const previousEnv = { @@ -67,7 +69,7 @@ describe("open-pr command timeouts", () => { code: "git-failure", message: expect.stringContaining(`timed out after ${SHORT_TIMEOUT_MS}ms`), }); - expect(Date.now() - started).toBeLessThan(1_500); + expect(Date.now() - started).toBeLessThan(RETURN_TIMEOUT_MS); }, ); @@ -90,7 +92,7 @@ describe("open-pr command timeouts", () => { code: "github-failure", message: expect.stringContaining(`timed out after ${SHORT_TIMEOUT_MS}ms`), }); - expect(Date.now() - started).toBeLessThan(1_500); + expect(Date.now() - started).toBeLessThan(RETURN_TIMEOUT_MS); }, ); });