Skip to content

Commit e47df9e

Browse files
committed
perf(test): tighten background-abort e2e wait
1 parent b7c75f3 commit e47df9e

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/agents/bash-tools.exec.background-abort.e2e.test.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { afterEach, expect, test } from "vitest";
2-
import { sleep } from "../utils.ts";
32
import {
43
getFinishedSession,
54
getSession,
@@ -52,7 +51,17 @@ async function expectBackgroundSessionSurvivesAbort(params: {
5251
const sessionId = (result.details as { sessionId: string }).sessionId;
5352

5453
abortController.abort();
55-
await sleep(150);
54+
const startedAt = Date.now();
55+
await expect
56+
.poll(
57+
() => {
58+
const running = getSession(sessionId);
59+
const finished = getFinishedSession(sessionId);
60+
return Date.now() - startedAt >= 100 && !finished && running?.exited === false;
61+
},
62+
{ timeout: process.platform === "win32" ? 1_500 : 800, interval: 20 },
63+
)
64+
.toBe(true);
5665

5766
const running = getSession(sessionId);
5867
const finished = getFinishedSession(sessionId);

0 commit comments

Comments
 (0)