test: stop depending on another test file's leaked indexedDB global - #1201
Open
njbrake wants to merge 1 commit into
Open
test: stop depending on another test file's leaked indexedDB global#1201njbrake wants to merge 1 commit into
njbrake wants to merge 1 commit into
Conversation
_Note: this PR description was drafted by Claude via back-and-forth with @njbrake. The reasoning and decisions are his; the prose is Claude's._ Removes a cross-file dependency that makes `sidebar-footer.test.tsx` fail depending on test order. Its "sync retry flow" block enables sync, which puts the encryption config on the render path. That reads the bare `indexedDB` global, which happy-dom does not implement, so the tests only passed when some earlier test *file* had already stubbed it. With `--randomize`, an ordering that runs this file first fails with `ReferenceError: indexedDB is not defined`. `use-app-initialization.test.tsx` was the accidental supplier, and its restore was itself wrong: it captured `globalThis.indexedDB` at module load (undefined, since happy-dom has none) and wrote that back in `afterAll`, leaving the property defined-but-undefined rather than absent. Adds `stubIndexedDb`/`restoreIndexedDb`, which delete the global when it did not exist before, and has both files opt in explicitly. The absence is load-bearing elsewhere, since the boot pipeline's storage pre-flight is supposed to report STORAGE_UNAVAILABLE without it, so this stays opt-in rather than going into the global preload. I saw this fail on a randomized run of `main`. I could not pin a seed that reproduces it on `main` itself, but it reproduces deterministically once any single extra test file changes the shuffle. Co-Authored-By: Claude Opus 5 (1M context) <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.
Note: this PR description was drafted by Claude via back-and-forth with @njbrake. The reasoning and decisions are his; the prose is Claude's.
Removes a cross-file dependency that makes
sidebar-footer.test.tsxfail depending on test order.Its "sync retry flow" block enables sync, which puts the encryption config on the render path. That reads the bare
indexedDBglobal, which happy-dom does not implement, so the tests only passed when some earlier test file had already stubbed it. With--randomize, an ordering that runs this file first fails withReferenceError: indexedDB is not defined.use-app-initialization.test.tsxwas the accidental supplier, and its restore was itself wrong: it capturedglobalThis.indexedDBat module load (undefined, since happy-dom has none) and wrote that back inafterAll, leaving the property defined-but-undefined rather than absent.Adds
stubIndexedDb/restoreIndexedDb, which delete the global when it did not exist before, and has both files opt in explicitly. The absence is load-bearing elsewhere, since the boot pipeline's storage pre-flight is supposed to report STORAGE_UNAVAILABLE without it, so this stays opt-in rather than going into the global preload.I saw this fail on a randomized run of
main. I could not pin a seed that reproduces it onmainitself, but it reproduces deterministically once any single extra test file changes the shuffle.