Skip to content

Commit 661c963

Browse files
cliffhallclaude
andcommitted
test(web): correct the sequence.hooks default claim (it's "stack" in vitest 4, not "parallel") (round 14)
Round-14 review of PR #1793 (merge-verdict): - Finding 1: verified against installed vitest 4.1.0 — `resolved.sequence.hooks ??= "stack"` (coverage chunk), so the runtime default is "stack"; the CLI help-text's "parallel" is stale in vitest itself. The vite.config.ts comment claimed the pin overrides a "parallel" default; corrected to say the pin is Vitest 4's own default made explicit (documents intent + guards a future default change), which is a truer reason to keep it than an override. - Nit: tied the two additions together — the post-settle check's same-level race can only arise if someone changes sequence.hooks to "parallel" (same-level hooks run sequentially under "stack"/"list"), so the pin and the post-check now reference each other rather than sitting in opposed positions. ViewHeader unchanged; npm run ci green. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01XNdjEPKLG637X8YmhDiEk5
1 parent 6596a6d commit 661c963

2 files changed

Lines changed: 19 additions & 15 deletions

File tree

‎clients/web/src/test/renderWithMantine.tsx‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,11 @@ export async function settleTransitions(ms: number = DEFAULT_SETTLE_MS) {
166166
// containers, which guard against a future regression that makes cleanup run
167167
// before this settle finishes — e.g. cleanup moved to a *same-level* hook: the
168168
// pre-settle check catches it running entirely first, the post-settle check
169-
// catches it detaching the tree concurrently while this hook awaits (a
170-
// same-level "parallel" race the pre-check can't see). Neither fires in the
171-
// current outer-cleanup setup. A container the test unmounted itself isn't in
169+
// catches it detaching the tree concurrently while this hook awaits — a race
170+
// that can only arise if the unit project's `sequence.hooks` is changed from
171+
// "stack" to "parallel" (same-level hooks run sequentially under "stack"/"list"),
172+
// which is exactly why the pre-check can't see it. Neither fires in the current
173+
// outer-cleanup setup. A container the test unmounted itself isn't in
172174
// the set, so its legitimate detach is never mistaken for that regression.
173175
afterEach(async () => {
174176
const ms = armedSettleMs;

‎clients/web/vite.config.ts‎

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -290,18 +290,20 @@ export default defineConfig(({ command }) => {
290290
// Integration tests run in the integration project below (node env).
291291
exclude: [integrationGlob],
292292
setupFiles: [path.join(dirname, "src/test/setup.ts")],
293-
// Run after-hooks LIFO (reverse registration) instead of Vitest's
294-
// default "parallel". This is defense-in-depth, NOT load-bearing:
295-
// the real-transitions auto-settle in `src/test/renderWithMantine.tsx`
296-
// needs its `afterEach` to complete before `setup.ts`'s setupFile
297-
// `cleanup()` unmounts the tree (avoiding the #1760 post-teardown
298-
// `window is not defined` leak, #1786), and that already holds in
299-
// *every* `sequence.hooks` mode because `cleanup()` is a setupFile
300-
// (outer) hook, which Vitest runs after inner afterEach hooks
301-
// regardless of this setting (verified across stack/list/parallel).
302-
// Pinning "stack" just makes the conventional LIFO ordering explicit;
303-
// the settle's own before/after `container.isConnected` self-checks
304-
// are the real guard against a future regression.
293+
// Pin after-hooks to LIFO (reverse registration). This is Vitest 4's
294+
// own default (`resolved.sequence.hooks ??= "stack"` — the CLI
295+
// help-text's "parallel" is stale), so this line documents intent and
296+
// guards a future default change rather than overriding anything. It's
297+
// defense-in-depth, NOT load-bearing: the real-transitions auto-settle
298+
// in `src/test/renderWithMantine.tsx` needs its `afterEach` to complete
299+
// before `setup.ts`'s setupFile `cleanup()` unmounts the tree (avoiding
300+
// the #1760 post-teardown `window is not defined` leak, #1786), and
301+
// that already holds in *every* `sequence.hooks` mode because
302+
// `cleanup()` is a setupFile (outer) hook, which Vitest runs after
303+
// inner afterEach hooks regardless of this setting (verified across
304+
// stack/list/parallel). The settle's own before/after
305+
// `container.isConnected` self-checks are the real guard against a
306+
// future regression.
305307
sequence: { hooks: "stack" },
306308
},
307309
},

0 commit comments

Comments
 (0)