-
-
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
unexpected output when using custom toJSON #8098
Comments
@pedrottimark I think "no visual difference" error is gone. In addition - in this case, could we somehow mark the fact the string came from @jeysal might have an idea here as well |
Yes:
@goenning The “this doesn't work” assertion compares an object to a string, which fails, and then the custom serialization makes it looks as if it should have passed. So that I can understand the context, did you decide that the “this works” assertion is what you meant to test? |
I didn’t know that toJSON was part of JSON.stringify function. I thought this was a Jest convention. My primary issue was #8097 I understand now that toJSON is just used for presentation and not for assertion. For me this issue is not affecting me anymore, but it could be confusing for others. Whether you consider to fix it or not is up to you. Thanks for the explanation. |
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 14 days. |
Doesn't seem like anybody else has run into this |
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
I got the following report from Jest:
This is very confusing as both texts are exactly the same.
To Reproduce
Expected behavior
I should work the same way as the previous assertion OR if this is expected behavior, the output message should explain what's wrong.
Link to repl or repo (highly encouraged)
https://repl.it/repls/TurboGlassMotion
Run
npx envinfo --preset jest
Paste the results here:
System: OS: macOS 10.14.3 CPU: (4) x64 Intel(R) Core(TM) i5-6500 CPU @ 3.20GHz Binaries: Node: 10.15.2 - /usr/local/bin/node npm: 6.4.1 - /usr/local/bin/npm npmPackages: jest: 24.3.1 => 24.3.1
The text was updated successfully, but these errors were encountered: