Skip to content

Conversation

@sheremet-va
Copy link
Member

Fixes #8040

Description

Please don't delete this checklist! Before submitting the PR, please make sure you do the following:

  • It's really useful if your PR references an issue where it is discussed ahead of time. If the feature is substantial or introduces breaking changes without a discussion, PR might be closed.
  • Ideally, include a test that fails without this PR but passes with it.
  • Please, don't make changes to pnpm-lock.yaml unless you introduce a new test example.

Tests

  • Run the tests with pnpm test:ci.

Documentation

  • If you introduce new functionality, document it. You can run documentation with pnpm run docs command.

Changesets

  • Changes in changelog are generated from PR name. Please, make sure that it explains your changes in an understandable manner. Please, prefix changeset messages with feat:, fix:, perf:, docs:, or chore:.

@netlify
Copy link

netlify bot commented May 29, 2025

Deploy Preview for vitest-dev ready!

Name Link
🔨 Latest commit 3536c16
🔍 Latest deploy log https://app.netlify.com/projects/vitest-dev/deploys/68385d65ca27ec0008f978f4
😎 Deploy Preview https://deploy-preview-8053--vitest-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

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

Comment on lines -125 to -133
// stack is not serialized in worker communication
// we stringify it first
if (typeof err.stack === 'string') {
err.stackStr = String(err.stack)
}
if (typeof err.name === 'string') {
err.nameStr = String(err.name)
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was feeling this is mostly redundant for a long time 😄

@sheremet-va sheremet-va merged commit 3bdf05d into vitest-dev:main May 30, 2025
13 checks passed
@sheremet-va sheremet-va deleted the fix/error-serialise-keep-non-enumerable branch May 30, 2025 11:12
@Jinjiang
Copy link

Jinjiang commented Jun 5, 2025

Seems this PR breaks our code because we use err.stackStr. I understand using err.stack instead should fix?

@sheremet-va
Copy link
Member Author

Seems this PR breaks our code because we use err.stackStr. I understand using err.stack instead should fix?

Yes, use stack

@sheremet-va
Copy link
Member Author

Seems this PR breaks our code because we use err.stackStr. I understand using err.stack instead should fix?

By the way, note that Vitest 4 will remove ErrorWithDiff type and replace it with TestError (it's already available)

@Jinjiang
Copy link

Jinjiang commented Jun 5, 2025

I see. Good to know. Thanks.

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.

Errors with toJSON method are not formatted correctly

3 participants