Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

test: support fake timers in focus cleanup

Steven Enamakel0b479f83f2c7
diff --git a/app/src/test/setup.ts b/app/src/test/setup.ts
index e399d50632..1b642b7381 100644
--- a/app/src/test/setup.ts
+++ b/app/src/test/setup.ts
@@ -395,7 +395,11 @@ afterEach(async () => {
// before Vitest tears the environment down.
alignGlobalEventWithDom();
cleanup();
- await new Promise<void>(resolve => window.setTimeout(resolve, 0));
+ // Fake-timer suites own their clock. Awaiting a synthetic timer there would
+ // wait until Vitest's per-test timeout, rather than draining anything.
+ if (!vi.isFakeTimers()) {
+ await new Promise<void>(resolve => window.setTimeout(resolve, 0));
+ }
alignGlobalEventWithDom();
// Re-seed the IPC handle after any test that may have deleted it
// (e.g. tests exercising the CEF-gap branch of `isTauri()`). Without