You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Flaky test teardown: Mantine Transition timer fires after happy-dom window teardown (window is not defined) #1760
An npm run coverage / CI build job can fail even when all tests pass, because Vitest exits non-zero on 1 unhandled error:
⎯⎯ Uncaught Exception ⎯⎯
ReferenceError: window is not defined
❯ resolveUpdatePriority node_modules/react-dom/cjs/react-dom-client.development.js:1308:7
❯ requestUpdateLane react-dom-client.development.js:16345:11
❯ dispatchSetState react-dom-client.development.js:9126:14
❯ Timeout._onTimeout @mantine/core/esm/components/Transition/use-transition.mjs:61:13
❯ listOnTimeout node:internal/timers:585:17
This error originated in "src/components/groups/ServerRemoveConfirmModal/ServerRemoveConfirmModal.test.tsx"
Observed on PR #1759's CI (build run 30098049855) — 298 passed / 4426 tests passed, but Errors: 1 error → exit 1.
Root cause
ServerRemoveConfirmModal renders a Mantine Modal, which drives an open/close Transition via a setTimeout. The test doesn't wait for the transition to settle / unmount cleanly, so a pending Transition timer can fire after the happy-dom environment (and its window) has been torn down at the end of the run. The timer's dispatchSetState then hits resolveUpdatePriority, which reads window → ReferenceError. It's timing-dependent, so it only trips occasionally (it did not reproduce under a local npm run ci).
This is a general class issue — any component test rendering a Mantine Transition/Modal/Menu/Popover through renderWithMantine is exposed, not just this one modal.
Recommended fix
clients/web/src/test/renderWithMantine.tsx wraps in <MantineProvider theme={theme} defaultColorScheme="light">withoutenv="test". Setting env="test" makes Mantine render transitions synchronously (no setTimeout), which eliminates the whole class of post-teardown timer races in one place:
Validate that no test relies on transition timing after the switch (a few may need a waitFor/findBy adjustment). Alternative/narrower options: give the modal transitionProps={{ duration: 0 }} in the test, or vi.useFakeTimers() + flush before unmount — but env="test" on the shared provider is the durable, repo-wide fix.
Impact
Low correctness risk (all assertions pass), but it can red an otherwise-green CI run, so worth making deterministic.
Fixed via #1761 (squashed into v2/main). Shared renderWithMantine now sets env="test" (transition-free); the three ViewHeader animation tests opt into real transitions via renderWithMantineTransitions.
Activity
docs: note the renderWithMantine env=test invariant in AGENTS.md (#1760)
web: disable Mantine transitions in tests to kill post-teardown timer…
cliffhall commentedon Jul 24, 2026
Fixed via #1761 (squashed into v2/main). Shared renderWithMantine now sets env="test" (transition-free); the three ViewHeader animation tests opt into real transitions via renderWithMantineTransitions.
test(web): address review — export settleTransitions, derive settle f…
test(web): make renderWithMantineTransitions own the settle (round 4)
test(web): downgrade (not disarm) the auto-settle on self-unmount; pe…
test(web): fix the regressed fake-timer doc + guarantee the liveness …
test(web): settle real-timer Transitions so the coverage gate can't l…
review: round-6 fixes — document roots in the CLI README, harden clea…
fix(core): register peer-request handlers before connect (#1797) (#1798)