Skip to content

fix(runner): don't fail collection when accessing error.stack throws - #10839

Merged
sheremet-va merged 1 commit into
mainfrom
fix/frozen-object-prototype-location
Jul 29, 2026
Merged

sheremet-va merged 1 commit into
mainfrom
fix/frozen-object-prototype-location

Conversation

@sheremet-va

Copy link
Copy Markdown
Member

Description

With includeTaskLocation enabled, the runner reads error.stack for every registered test and suite. Reading .stack invokes Vite's prepareStackTrace sourcemap interceptor, which throws if the test file ran Object.freeze(Object.prototype) (root cause fixed in vitejs/vite#23073), failing collection of the whole file. Guard the .stack access in findTestFileStackTrace so the task only loses its location.

Fixes vitest-dev/vscode#798

With `includeTaskLocation` enabled, the runner reads `error.stack` for
every registered test and suite. Reading `.stack` invokes Vite's
`prepareStackTrace` sourcemap interceptor, which currently throws
`TypeError: Cannot assign to read only property 'constructor'` if the
test file ran `Object.freeze(Object.prototype)`, failing collection of
the whole file (vitest-dev/vscode#798).

Move the `.stack` access into `findTestFileStackTrace` and guard it so
the task just loses its location instead of failing collection.
@netlify

netlify Bot commented Jul 27, 2026

Copy link
Copy Markdown

Deploy Preview for vitest-dev ready!

Name Link
🔨 Latest commit dcb7486
🔍 Latest deploy log https://app.netlify.com/projects/vitest-dev/deploys/6a672e4fbc12df00093ca50f
😎 Deploy Preview https://deploy-preview-10839--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 requested review from hi-ogawa and macarie July 27, 2026 10:43
@sheremet-va
sheremet-va merged commit 202e27f into main Jul 29, 2026
28 of 29 checks passed
@sheremet-va
sheremet-va deleted the fix/frozen-object-prototype-location branch July 29, 2026 14:43
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 13, 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.

Object.freeze(Object.prototype) crashing vitest process

1 participant

Sponsor
SponsoredKunjungi sekarang
Promo