-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
Expected behaviour of snapshot property matchers #6455
Comments
PR most welcome 🙂 @rickhanlonii Told you somebody would need it! :D |
Happy to give this a shot, any preference on the implementation? Should the default behaviour be updated, which will most likely break some existing use cases, or should this be a new method or something else entirely ? |
Ah, yes, the difficulty here is doing a performant deep merge correctly. I ran into issues with symbols and prototypes when trying to fix this, happy to see someone else give it a shot! I would say this is a bug fix for the default behavior and push in a minor release (though that may require some snapshot updates, I think that's better than waiting for the next major) |
Fixing this would be very welcome. Until I found this issue, I thought I'm missing something. |
Pretty swamped in work but managed to take a look for a few hours. Tried utilising the deep merge from some other library's but with no success, I can't even get the relevant tests to pass locally, hard to say when I'll have the time to look at this again so if anyone else wants to give it a go, feel free! |
I might look into this. I'm having the same issue, and it can be misleading because the test passes, but the snapshot does not store what you think it does (it only stores the custom matchers), making the test quite inefficient. |
@WaldoJeffers I have a PR out for this issue. Would you want to take a look at it and let me know what you think? I’d really appreciate any feedback people can give me, as it’s my first PR to this project. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
🐛 Bug Report
When using property matchers for snapshot testing, if a property matcher is defined within a nested object, then remaining properties are excluded from the generated snapshot.
To Reproduce
Steps to reproduce the behavior:
bar: ''
.e.g:Expected behavior
Expected the following snapshot to be generated:
Link to repl or repo (highly encouraged)
recommended repl seems to be running Jest v22.1.2, so won't work here
Run
npx envinfo --preset jest
Paste the results here:
The text was updated successfully, but these errors were encountered: