Skip to content

Commit f0f132f

Browse files
committed
test(daemon): simplify the fake-clock timed-out wait test per review
Drop the justification comment and the settled-result wrapper: the capture path in this scenario is caught end-to-end by toDaemonResponse, so runWait cannot reject here, and the existing test name/assertions already state the invariant.
1 parent 2262ce0 commit f0f132f

1 file changed

Lines changed: 2 additions & 20 deletions

File tree

‎src/daemon/__tests__/wait-runtime.test.ts‎

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -308,34 +308,16 @@ test('a provider owner that cannot capture fails closed instead of borrowing the
308308
// the SAME binding rather than reaching a second capture owner.
309309
// ---------------------------------------------------------------------------
310310

311-
/**
312-
* The 1ms timeout races the real clock: on a loaded CI host the first capture can take longer
313-
* than 1ms to resolve, so `runWithinWaitDeadline` classifies it `capture-stalled` (or, once a
314-
* later poll is readable, `capture-truncated`) instead of a completed target-absent poll, and
315-
* `maybeWaitTimeoutSurfaceResponse` skips the decoration outright (see wait-current-surface.ts).
316-
* A fake clock removes the race the same way `runFill` does in
317-
* packages/provider-webdriver/src/webdriver-interactor.test.ts: virtual time only advances when
318-
* `advanceTimersByTimeAsync` says so, so the mocked (instant, non-timer) capture always resolves
319-
* before the deadline timer is due, on any host (docs/agents/testing.md: production time must
320-
* never be real time in tests).
321-
*/
322311
test('a timed-out wait decorates its failure through the same single binding', async () => {
323312
vi.useFakeTimers();
324313
try {
325314
const harness = waitRuntimeHarness({
326315
nodesPerPoll: [[{ index: 0, depth: 0, type: 'Button', label: 'Checkout', hittable: true }]],
327316
});
328317

329-
// Settled-shaped from the start: a rejection that lands while the clock is being advanced
330-
// would otherwise be unhandled until the await below.
331-
const pending = runWait(['text', 'Ready', '1'], harness).then(
332-
(value) => ({ rejected: false, value }) as const,
333-
(error: unknown) => ({ rejected: true, error }) as const,
334-
);
318+
const pending = runWait(['text', 'Ready', '1'], harness);
335319
await vi.advanceTimersByTimeAsync(5_000);
336-
const settled = await pending;
337-
if (settled.rejected) throw settled.error;
338-
const { response } = settled.value;
320+
const { response } = await pending;
339321

340322
expect(response.ok).toBe(false);
341323
if (response.ok) return;

0 commit comments

Comments
 (0)