Repository navigation
test(web): migrate browser tests to the disposable render helper (6/8) - #22276
Merged
Merged
Conversation
…e render helper (6/8) Seventeen browser tests under components/settings and components/search now acquire their screen with `await using screen = await render(...)` instead of hand-managed React roots and lifecycle hooks. Mock state their vi.mock factories read is reset by a setup() call at the top of each test, and per-test globals, fake timers and spies are disposables. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — This PR is a browser-test harness migration confined to ignored test paths, with no changes to shipped product behavior, defaults, deployment, or sensitive functionality. Its large diff is mechanical test-lifecycle refactoring rather than a production runtime change. Notes:
You can add or adjust custom eligibility rules. Learn more. |
mountPanel and openSettings wait for the first paint after render(), before the caller's `await using` owns the screen. A timeout there left the tree mounted for the rest of the file, so the helpers now hold the screen in an AsyncDisposableStack until they hand it back. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
macroscopeapp
Bot
dismissed
their stale review
October 20, 2026 10:33
Dismissing prior approval to re-evaluate 7e8dda4
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.
Slice 6 of 8 of the
t3code/require-disposable-rendermigration. The lint rule still flagged 132 files onab423b24a8. This PR takes sorted entries 86–102. These files mounted React roots by hand, setIS_REACT_ACT_ENVIRONMENTfor the whole test, and used lifecycle hooks, which together produced 232 act warnings per run.Each test now acquires its own screen with
await using screen = await render(...). Mock state thatvi.mockfactories read is reset by asetup()call at the top of the test (resetSetup()in ProviderSetupSection, which already has a hoistedsetupmock object). Globals, spies (navigator.platform,useRightPanelStore.openFile) and fake timers areusingdisposables, and every rerender builds a fresh element. No assertions were removed or added.Files
src/components/search/ProjectContentSearchDialog.browser.test.tsxsrc/components/settings/AcpRegistryIcon.browser.test.tsxsrc/components/settings/AcpRegistrySearchStep.browser.test.tsxsrc/components/settings/AcpSessionManagementSection.browser.test.tsxsrc/components/settings/AddProviderInstanceDialog.environment.browser.test.tsxsrc/components/settings/CaptureShortcutConfig.browser.test.tsxsrc/components/settings/DeviceToolUpdate.browser.test.tsxsrc/components/settings/FontFamilyPicker.browser.test.tsxsrc/components/settings/IntegrationsSettings.browser.test.tsxsrc/components/settings/KeybindingsSettings.environment.browser.test.tsxsrc/components/settings/ProjectFaviconPickerDialog.browser.test.tsxsrc/components/settings/ProjectIconPickerDialog.browser.test.tsxsrc/components/settings/ProjectSettingsPanel.browser.test.tsxsrc/components/settings/ProviderInstanceCard.browser.test.tsxsrc/components/settings/ProviderSettingsPanel.environment.browser.test.tsxsrc/components/settings/ProviderSetupSection.browser.test.tsxsrc/components/settings/SecretInput.browser.test.tsxLeft unmigrated: none.
router: falseProjectSettingsPanel.browser.test.tsx(bothmountPanelandmountSettings). It was not flaky. The tests build their own route trees: nestedsettings/projectsroutes withvalidateSearchand theretainSettingsScopemiddleware, and they navigate through them. The helper's single root route can't express that, so these render their ownRouterProviderand spread the router onto the returned screen.Router change: IntegrationsSettings used to build its own router only to have one. It now uses the helper's default router, with
StrictModearound the panel instead of around theRouterProvider.Verification
Slice only,
vp test run --project browser --reporter=verbose <17 files>:The same files before migration also pass 117/117, but emit 232 act warnings per run. Stderr blocks per run went from 330 to 20, and the remaining 20 also appear before migration: 19
ResizeObserver loop completednotices and a legend-listrecycleItemsnotice.vp linton apps/web reports 0 warnings of any kind for these 17 files (the rule's total dropped from 635 to 552), andvp run typecheckin apps/web passes. None of the files use jsdom, happy-dom, orreact-dom/client.Done by Claude Opus 5.5 in Claude Code (T3 Code).
🤖 Generated with Claude Code