From 48f470c465a866d24ca80814f43d63b4ffe19b6b Mon Sep 17 00:00:00 2001 From: MHSanaei Date: Mon, 1 Jun 2026 09:10:35 +0200 Subject: [PATCH] fix(test): drain macrotasks via setTimeout, not setImmediate setImmediate is a Node global not declared in the frontend's DOM tsconfig, so tsc --noEmit failed with 'Cannot find name setImmediate'. setTimeout is universally typed and still flushes React's pending setImmediate: looping the awaits keeps afterEach unresolved across several event-loop iterations, so the queued check-phase callback fires while window still exists. --- frontend/src/test/setup.components.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/test/setup.components.ts b/frontend/src/test/setup.components.ts index eb732b51..c2f6e0a6 100644 --- a/frontend/src/test/setup.components.ts +++ b/frontend/src/test/setup.components.ts @@ -71,6 +71,6 @@ afterEach(async () => { * one behind the first. */ for (let i = 0; i < 3; i += 1) { - await new Promise((resolve) => setImmediate(resolve)); + await new Promise((resolve) => setTimeout(resolve, 0)); } });