Repository navigation
fix(frontend): stop the heading-focus wait once the document is gone - #848
Merged
Merged
Conversation
focusHeadingOnArrival polls for up to 10 s. When a test ends first, its next tick ran after jsdom tore down document and threw an uncaught ReferenceError, which fails the whole vitest run (seen on main 1418484 and PR #847, from RulePageDelete.test.tsx). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
focusHeadingOnArrivalpolls every 50 ms for up to 10 s. When a test finishes before that, the next tick runs after jsdom has torn downdocumentand throwsReferenceError: document is not defined. Vitest counts that as an unhandled error and fails the run even though every test passed.RulePageDelete.test.tsx.documentis gone. A browser always has adocument, so behaviour there does not change.Test
focusArrival.test.ts: it stubsdocumentas undefined mid-wait and asserts that the timers neither throw nor reschedule. It fails without the guard (Cannot read properties of undefined (reading 'querySelectorAll')) and passes with it.focusArrival,RulePageDeleteand the classifications tests pass (166 tests). eslint is clean.Docs
🤖 Generated with Claude Code