Skip to content

fix(browser): exit gracefully when the browser disconnects during cancellation - #10962

Open
sheremet-va wants to merge 2 commits into
mainfrom
fix/browser-cancel-close-check
Open

fix(browser): exit gracefully when the browser disconnects during cancellation#10962
sheremet-va wants to merge 2 commits into
mainfrom
fix/browser-cancel-close-check

Conversation

@sheremet-va

Copy link
Copy Markdown
Member

Description

The graceful-cancel branch in the browser pool checked

error.message.startsWith('Browser connection was closed while running tests')

but the error created by the websocket close handler has always carried the [vitest] prefix. Both sides were introduced in the same commit (#7665), so the branch has never matched: cancelling a run (for example with Ctrl+C) while the browser connection drops reported Failed to run the test ... as an unhandled error instead of exiting quietly.

Instead of fixing the string, the close handler now rejects pending calls with a dedicated BrowserConnectionError (exported from vitest/node), and the pool matches on the type. The regression test cancels the run from a browser command and then crashes the renderer, so the pending createTesters call rejects while isCancelling is set; it fails on main with the unhandled error and passes with the fix.

@netlify

netlify Bot commented Aug 16, 2026

Copy link
Copy Markdown

Deploy Preview for vitest-dev ready!

Name Link
🔨 Latest commit af12796
🔍 Latest deploy log https://app.netlify.com/projects/vitest-dev/deploys/6a81b3cafd4132000952130e
😎 Deploy Preview https://deploy-preview-10962--vitest-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant