Skip to content

feat(breaking): Output jest mock function names in snapshot diff #122

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

Conversation

alistairjcbrown
Copy link
Contributor

@alistairjcbrown alistairjcbrown commented Apr 26, 2020

Use same serializers as jest-snapshot when serializing React components
rendered by react-test-renderer.

With the React serializer updated to use prettyFormat, this now
supports diffing React fragments when comparing a single element to
multiple elements returned. Adding test to confirm output.

Fixes #106
Fixes #111

Use same serializers as jest-snapshot when serializing react components
rendered by react-test-renderer.

Fixes jest-community#106
@alistairjcbrown
Copy link
Contributor Author

Using prettyFormat also has the nice benefit of solving #111 too - will add an additional commit with a new test for snapshotDiff to show the output

With the React serializer updated to use `prettyFormat`, this now
supports diffing React fragments when comparing a single element to
multiple elements returned. Adding test to confirm output.

Fixes jest-community#111
@alistairjcbrown
Copy link
Contributor Author

@thymikee give me a shout if there's anything that needs updated or added to this PR.
Hopefully closes off a couple of open issues 🤞

Copy link
Member

@thymikee thymikee left a comment

Choose a reason for hiding this comment

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

Awesome, using serializers from jest-snapshot totally makes sense 👍

Makes use of the same serializers used for printing, in the react
serializer diff options which set up the A and B diff annotations.
@alistairjcbrown
Copy link
Contributor Author

@thymikee Good catch - added serializers in diff options and updated test to show new annotations output 👍

@thymikee thymikee changed the title Output jest mock function names in snapshot diff feat(breaking): Output jest mock function names in snapshot diff May 6, 2020
@thymikee thymikee merged commit 5d38d77 into jest-community:master May 6, 2020
@alistairjcbrown alistairjcbrown deleted the bugfix/output-jest-mock-function-names branch May 6, 2020 22:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants