🤖 tests: isolate renderer test globals#3574
Merged
Merged
Conversation
Member
Author
|
@codex review |
|
Codex Review: Didn't find any major issues. Breezy! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
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
Background
bun test srcruns many renderer test files in one process locally, so file-scopemock.module()registrations and directglobalThis.window/documentoverwrites can leak into later suites.useChatTranscriptFullWidthnot calling its real API context afteruseModelsFromSettings,events.testseeingdocumentas undefined,chatCommandsinheriting a remotewindow.location, andImmersiveReviewViewrendering a stubbed diff renderer fromProposePlanToolCall.Implementation
useModelsFromSettingsandProposePlanToolCallmodule mocks behind setup/teardown helpers that restore the real module exports after each test.installDom()or explicit previous-global restoration so renderer tests leave the global DOM state as they found it.events.testinstall its own DOM per test instead of relying on a one-time side-effect import.Validation
bun test src/browser/hooks/useModelsFromSettings.test.ts src/browser/hooks/useChatTranscriptFullWidth.test.tsx src/browser/utils/events.test.tsbun test src/browser/hooks/useRouting.test.ts src/browser/utils/chatCommands.test.tsbun test src/browser/features/Tools/ProposePlanToolCall.test.tsx src/browser/features/RightSidebar/CodeReview/ImmersiveReviewView.test.tsxbun test src/browser/hooks src/browser/utilsmake static-checkRisks
Pains
make testnow gets past the renderer failures but still exits on the pre-existing local Storybook budget guard (71 > 70snapshot-enabled story files,276 > 262estimated snapshots), which is unrelated to this diff and not part of the CI unit shard.Generated with
mux• Model:openai:gpt-5.5• Thinking:xhigh• Cost:$46.22