-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Snapshot comparison failing but results look identical #9865
Comments
Related to #9863? |
Possibly. It is very hard for me to tell because this is only failing on our Jenkins server. Running locally does not cause the problem. This could be because the code generating the console output is different on different OS and my local environment is different than the deployed environment. |
You can try running with |
Already doing that. There is no color in the output. Color is disabled on all tests. |
I finally just created a separate entire test environment on Linux to match the Jenkins as best I could and was able to reproduce the problem. For some reason, on Windows my generated snapshot looks like this:
but on Linux it looks like this:
Why is Jest adding extra carriage returns outside the string value on Windows? And why should that matter at all for the snapshot comparison? |
This turned out to be caused by Winston logger using |
We discussed this some in #6881, but no obvious solution was found at the time. Seeing as that issue is closed, do you wanna open up a feature request with it? |
I dunno how to approach this really. I was simply pointing out that this does have real-world consequences because I just spent 3 days debugging to find this as the root cause. I'm actually a fan on unifying on One possibility would be to create a |
I don't think Jest should normalize this into Place in Jest would be somewhere inside |
Agreed I don't think Jest should address this at all except for potentially offering a more revealing result from a diff:
|
Yeah exactly, that's what concordance does |
This issue is stale because it has been open for 1 year with no activity. Remove stale label or comment or this will be closed in 30 days. |
This issue was closed because it has been stalled for 30 days with no activity. Please open a new issue if the issue is still relevant, linking to this one. |
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
A unit test is failing in one environment but not others. The output is very unhelpful because the serialized results look identical.
To Reproduce
Created a unit tests against captured console output using
toMatchSnapshot()
.The results of running this test look like this:
From this result I cannot fathom what is wrong with the matcher. As far as I know, this is not a custom matcher.
.log
is declared as a TSstring
type.As of right now I have no idea how to reproduce since the error has given me no indication of what is not matching.
Expected behavior
Output either matches and succeeds or provides a clear indication of how the matcher failed.
Link to repl or repo (highly encouraged)
No way to reproduce outside environment at the moment. No idea what is wrong because the error message is completely opaque.
envinfo
The text was updated successfully, but these errors were encountered: