Skip to content
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

feat: Export snapshot state to expect.extend. #1378

Merged
merged 5 commits into from May 29, 2022

Conversation

cpojer
Copy link
Contributor

@cpojer cpojer commented May 26, 2022

In order to use jest-image-snapshot, the snapshot state must be exposed as MatcherState in expect.extend() calls. This makes the plugin work, and I added a quick example as well.

@netlify
Copy link

netlify bot commented May 26, 2022

Deploy Preview for vitest-dev failed.

Name Link
🔨 Latest commit 0c2f40f
🔍 Latest deploy log https://app.netlify.com/sites/vitest-dev/deploys/6292fd54b11cb200088e5d50

expect.extend({ toMatchImageSnapshot })

test('image snapshot', () => {
expect(readFileSync('./test/stubs/input-image.png')).toMatchImageSnapshot()
Copy link
Member

Choose a reason for hiding this comment

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

Do we have a license/credit for this image?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated it with the vitest logo, so we don't have to get into those concerns (Just figured I'll use a real example from my code ;) ).

@antfu antfu enabled auto-merge (squash) May 29, 2022 04:14
@antfu antfu merged commit 4ec0a76 into vitest-dev:main May 29, 2022
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.

None yet

2 participants