-
Notifications
You must be signed in to change notification settings - Fork 198
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
Display n° of unmatched snapshots in the snapshot summary + "u" usage suggestion #77
Display n° of unmatched snapshots in the snapshot summary + "u" usage suggestion #77
Conversation
@anescobar1991 I see tests are failing. I know exactly why and I did some work to make it work ... but I'm not sure it enters in the scope of this PR. |
@thomasbertet this looks good! I do want to refactor the snapshot state related code at some point as I may be able to make use of some of the functions that jest-snapshot provides but I will do that later! I am curious about the tests, the test results looks funny because they show all tests passing but 7 snapshots failing. Is that a result of the changes you made? |
Yes well indeed it looks funny :) That is why I created the other branch #78
Yep, when you attempt to generate the screenshot and it fails, since I update the "singleton" snapshotState, Jest is aware of snapshots not matching expected shape, thus displaying the info. My work on the new matcher is supposed to handle this case, when you want a specific snapshot not to match. |
@anescobar1991 it is not pretty, but it works... I'm not really happy with this but nothing came up quite easily. Not updating the |
@thomasbertet I think this is fine. Just left one comment that should be easy to address. I might refactor the integration tests to avoid having to use that global but that is for me to worry about in my own separate PR that should not block this. |
@anescobar1991 sorry but it seems you did not left your comment ... or I am missing something ? 🦉 |
src/index.js
Outdated
function updateSnapshotState(oldSnapshotState, newSnapshotState) { | ||
return merge({}, oldSnapshotState, newSnapshotState); | ||
function updateSnapshotState(originalSnapshotState, partialSnapshotState) { | ||
if (global.skipReporting) { |
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.
maybe name this variable in a way that makes it obvious that it is for test purposes only? Something like UNSTABLE_SKIP_REPORTING
following the React convention? IDK
Yeah I had submitted a review but it never showed up. Now you should be able to see it though. @thomasbertet |
Yep thanks. It's done ! |
Hi there, this is my attempt to fix #61
Goal
How
snapshotState
when images differs.updateSnapshotState
, I hope you don't mind... there was a mix between merging & assigning to the singleton (the one & only snapshotState Jest is aware of and bases its report on)Results
How to test
› 1 snapshot test failed in 1 test suite. Inspect your code changes or press
uto update them.
Let me know if you need anything else to have this merge. Thanks!