Skip to content

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

Merged
sheremet-va merged 2 commits into
mainfrom
fix/browser-cancel-close-check
Aug 17, 2026
Merged

sheremet-va merged 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.

@sheremet-va
sheremet-va merged commit 67e8485 into main Aug 17, 2026
27 of 28 checks passed
@sheremet-va
sheremet-va deleted the fix/browser-cancel-close-check branch August 17, 2026 09:09
@github-actions github-actions Bot locked and limited conversation to collaborators Sep 1, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant