Skip to content

fix(pretty-format): support boxed symbols (fix #11445) - #11446

Merged
sheremet-va merged 2 commits into
vitest-dev:mainfrom
lehni:fix/pretty-format-boxed-symbol
Oct 2, 2026
Merged

sheremet-va merged 2 commits into
vitest-dev:mainfrom
lehni:fix/pretty-format-boxed-symbol

Conversation

@lehni

@lehni lehni commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Description

Fixes #11445

printSymbol() used String(val), which throws TypeError: Cannot convert a Symbol value to a string for boxed symbols (Object(Symbol('a'))). They reach it through the [object Symbol] branch of printBasicValue(). Using Symbol.prototype.toString.call(val) works for both primitive and boxed symbols.

Regression from #9609 (v5): boxed symbols formatted fine with loupe in v4.

Added a boxed symbol test to test/unit/test/pretty-format.test.ts. It fails without the fix and passes with it.

AI-assisted (Claude Code).

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.
  • Please check Allow edits by maintainers to make review process faster. Note that this option is not available for repositories that are owned by Github organizations.

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

netlify Bot commented Oct 2, 2026

Copy link
Copy Markdown

✅ Deploy Preview for vitest-dev ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit fe4db5d
🔍 Latest deploy log https://app.netlify.com/projects/vitest-dev/deploys/6abf7ec96aec0700086f9c61
😎 Deploy Preview https://deploy-preview-11446--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 eba4492 into vitest-dev:main Oct 2, 2026
28 of 29 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 17, 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.

%o / pretty-format throws on boxed symbols: "Cannot convert a Symbol value to a string" (regression in v5)

2 participants