diff --git a/packages/remote-react-components/e2e/cross-version-inprocess/vitest.config.ts b/packages/remote-react-components/e2e/cross-version-inprocess/vitest.config.ts index 2442c36b32..8c0334995e 100644 --- a/packages/remote-react-components/e2e/cross-version-inprocess/vitest.config.ts +++ b/packages/remote-react-components/e2e/cross-version-inprocess/vitest.config.ts @@ -28,6 +28,25 @@ export default mergeConfig(viteConfig, { "dev/vitest/setupBrowser.ts", ], include: REUSED_VISUAL_TESTS, + /* + * One tester iframe for the whole run, for the same reason the package's + * `visual` project sets it: Playwright's WebKit never releases a removed + * iframe's document, so vitest's per-file iframe churn leaves every + * finished file's realm behind — component library, all.css, fonts, last + * render — until the page dies mid-run (#3119). This harness reuses the + * same corpus on one browser, and it died at file 60 of 84 with + * `Browser connection was closed while running tests`. + * + * The shared realm suits it: setup.ts's first-wins `customElements.define` + * patch keeps the OLD flr-* registrations for the whole run, which is + * exactly one version per run anyway. + */ + isolate: false, + /* + * One page at a time. `browser.fileParallelism` is deprecated in vitest 4 + * in favour of this top-level option. + */ + fileParallelism: false, browser: { ...vitestBrowserTestConfig.browser, // dev/vitest/setupBrowser.ts calls it, so it has to be registered here @@ -37,7 +56,6 @@ export default mergeConfig(viteConfig, { serveFontsLocally, }, headless: true, - fileParallelism: false, // HTML comparison, not pixels — failure screenshots would only pollute the // reused tests' src/**/__screenshots__ dir. screenshotFailures: false,