Repository navigation
Fix flaky embed tests: identity loading outlives jsdom teardown - #6
Merged
Merged
Conversation
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.
Fixes the flaky
app/src/embed.test.tsfailure where identity loading started byAppoutlived the jsdom environment and threwReferenceError: localStorage is not definedafter teardown (example run).Root cause
AppstartsloadIdentity(IndexedDB →localStorage) in an effect. The embed tests waited only onesetTimeout(0)tick, and one mounted root was never unmounted, so identity loading could still be running when Vitest tore down jsdom. The effect also didn't check whether it had been unmounted until afterLocalProject.open, so a late identity result still opened a project, and a late failure became an unhandled rejection.Changes
app/src/App.tsx: the identity-loading effect ignores the result (or a rejection) ofloadIdentityonce the component has unmounted, and no longer opens aLocalProjectafter unmount.app/src/embed.test.ts:loadIdentityto track in-flight loads, andafterEachwaits for them to settle before the test ends;App.tsxchange.Tests
vitest run src/embed.test.tsran 20 times in a row: 20/20 passed with no unhandled errors.pnpm run lintandpnpm run testpassed (13 files, 42 tests).Changelog
None added: the project has no changelog.
UI
Not applicable. This doesn't change any UI.
Closes #5
Agents: claude-code (claude-opus-5-5)