-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
fix: add expect.soft support to toMatchSnapshot (#8673) #9231
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
- toMatchSnapshot, matchSnapshot, toMatchFileSnapshot, toThrowErrorMatchingSnapshot can be used with expect.soft - toMatchInlineSnapshot, toThrowErrorMatchingInlineSnapshot do not support expect.soft and throw an error if used with expect.soft
✅ Deploy Preview for vitest-dev ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
hi-ogawa
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you create tests in test/snapshots? test/core only allows single run, so it's probably hard to poke the edge cases here (e.g. creation scenario, update scenario, non-match scenario, etc)
|
@hi-ogawa , can you clarify what I should test in |
|
Sorry, my suggestion was a bit vague and I don't have concrete suggestion. Some ideas are:
|
|
For example, one "brittleness" is that current tests would break with force update |
…create/update/read-only scenarios
|
@hi-ogawa , thanks for your detailed input. |
Description
Resolves #8673
toMatchSnapshot,matchSnapshot,toMatchFileSnapshot,toThrowErrorMatchingSnapshotcan be used withexpect.soft. These methods use the existingwrapAssertionfunction from expect utils.toMatchInlineSnapshot,toThrowErrorMatchingInlineSnapshotcould not easily supportexpect.soft. These methods now throw an error if used withexpect.softPlease don't delete this checklist! Before submitting the PR, please make sure you do the following:
pnpm-lock.yamlunless you introduce a new test example.Tests
pnpm test:ci.Documentation
pnpm run docscommand.Changesets
feat:,fix:,perf:,docs:, orchore:.