test(codex): tolerate slower app-server startup

This commit is contained in:
Vincent Koc
2026-04-28 22:35:34 -07:00
parent 95adc64326
commit 67e8d35f1c

View File

@@ -170,9 +170,19 @@ function createAppServerHarness(
request,
requests,
async waitForMethod(method: string) {
await vi.waitFor(() => expect(requests.some((entry) => entry.method === method)).toBe(true), {
interval: 1,
});
await vi.waitFor(
() => {
if (!requests.some((entry) => entry.method === method)) {
const mockMethods = request.mock.calls.map(([calledMethod]) => String(calledMethod));
throw new Error(
`expected app-server method ${method}; saw ${requests
.map((entry) => entry.method)
.join(", ")}; mock saw ${mockMethods.join(", ")}`,
);
}
},
{ interval: 1, timeout: 30_000 },
);
},
async notify(notification: CodexServerNotification) {
await notify(notification);