-
-
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
Error when using window as a prop #4612
Comments
@HiDeoo Thank you very much for the link. Here is my question and observation so far: If you imagine an ideal solution, what would you like as value of that prop in a snapshot? It looks
|
This reminds me that |
I can confirm that I'm also as a matter of fact returning a |
@HiDeoo You would smile to see time-lapse scan of my brain like Pooh Bear: think, think, think. Before I make pull request for issue, can you share your thoughts about this candidate solution: If
|
Hi, thanks a lot for looking into this and also thinking about all possibles outcomes. From my understanding of your proposal, it should indeed fix the issue no matter the environment so we would get consistent results without any error. I would assume genuinely serializing window on different browsers will produce different results. I should even be able to test the PR locally on my previous code having this issue, remove my temporary workaround and should get green tests without any difference in the snapshots. |
Yes, the results did differ. Thanks if you can test #4750 locally. Your code review is welcome too :) |
Just tested your PR, after commenting out my workaround, it was a drop in solution and every tests passed without having to update any snapshots 🎉 . Regarding the code evolution in the PR and what you said above, I think it's better indeed to not consider Thanks for your amazing work. |
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. |
Do you want to request a feature or report a bug?
A bug.
What is the current behavior?
One third party React component I'm using use
window
as a prop. When trying to snapshot test it, I'm getting the following error:I'm guessing this is an issue with
pretty-format
as the same error can be reproduced when trying to pretty formatwindow
:This would lead to a similar error:
I've setup a small repro leading to this exact same error when trying to pretty format
window
.jest
version: 21.2.1node
version: 8.4.0yarn
version: 1.1.0The text was updated successfully, but these errors were encountered: