Skip to content

docs: document pretty-format and its usage across Vitest + add unit tests#10052

Merged
sheremet-va merged 17 commits into
vitest-dev:mainfrom
hi-ogawa:docs/pretty-format-overview
Apr 4, 2026
Merged

docs: document pretty-format and its usage across Vitest + add unit tests#10052
sheremet-va merged 17 commits into
vitest-dev:mainfrom
hi-ogawa:docs/pretty-format-overview

Conversation

@hi-ogawa

@hi-ogawa hi-ogawa commented Apr 3, 2026

Copy link
Copy Markdown
Collaborator

Description

Test cases are copied from #9609

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:.

Co-authored-by: Codex <noreply@openai.com>
@netlify

netlify Bot commented Apr 3, 2026

Copy link
Copy Markdown

Deploy Preview for vitest-dev ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit c3fd950
🔍 Latest deploy log https://app.netlify.com/projects/vitest-dev/deploys/69cf50553c7bb5000870c2f7
😎 Deploy Preview https://deploy-preview-10052--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.

hi-ogawa and others added 7 commits April 3, 2026 10:19
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
@hi-ogawa hi-ogawa marked this pull request as ready for review April 3, 2026 04:48
hi-ogawa and others added 3 commits April 3, 2026 14:02
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
@hi-ogawa hi-ogawa changed the title docs: document pretty-format and its usage across Vitest docs: document pretty-format and its usage across Vitest + add unit tests Apr 3, 2026
Comment thread packages/pretty-format/README.md Outdated

[GitHub](https://github.com/vitest-dev/vitest/tree/main/packages/pretty-format) | [Documentation](https://vitest.dev/)

## Usage

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'd like to keep readme to a minimum to reduce the size in node_modules. Let's follow the same logic we did for the mocker package (define usage in a separate .md file)

@hi-ogawa hi-ogawa Apr 4, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I don't mind moving this but that reasoning means you don't want excessive jsdoc in code too. What's the boundary?
(for example, should jsdoc also minimized and better to just link to vitest.dev?)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What's the boundary?

The boundary is README. Jsdoc is at least visible in the code editors

@hi-ogawa hi-ogawa requested a review from sheremet-va April 4, 2026 01:30
@sheremet-va sheremet-va merged commit d562712 into vitest-dev:main Apr 4, 2026
15 of 16 checks passed
@hi-ogawa hi-ogawa deleted the docs/pretty-format-overview branch April 4, 2026 08:50
- `escapeRegex: true`
- `printFunctionName: false`

Default snapshot plugin stack:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hi @hi-ogawa

I've seen you replies to my comment on commit: d562712#diff-66d9a6908a960275eb01c353475a4710c986b99fa3caf5cfe90f976ac5d69824R122

For some reason, the current GitHub UI doesn't let me see your comment 😅

Image

Could you please repost it here so that I can check it?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

(Ok, repeating here 😃)

I'm trying to migrate from Jest to Vitest and this different behavior from Jest/Vitest regarding Error Cause snapshot is a bit annoying.

@slorber I think timeline wise, there wasn't ErrorPlugin in jest and Vitest just added on its own only for diff diagnostic improvement so far. We have been avoiding snapshot breaking change by not adding it as snapshot serializer yet (and/or mostly forgotten since there was never request). Can you create an issue to explain what's different now?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Thanks @hi-ogawa

I've created an issue with minimal repros comparing Jest/Vitest here: #10339

@github-actions github-actions Bot locked and limited conversation to collaborators May 28, 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.

Document and add unit tests for @vitest/pretty-format

3 participants