-
-
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
snapshot serializer fails to serialize invalid dates #6631
Comments
Wanna send a pr for it? It's https://github.com/facebook/jest/blob/master/packages/pretty-format/src/index.js#L148-L150 |
Ok will do now, since I've already did a custom serializer for that in my project... |
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. |
This issue was closed because it has been stalled for 7 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
To Reproduce
Create a simple test with the code above
Expected behavior
Even if it sounds weird to expect a date to be invalid, it shouldn't fail to create a snapshot with an invalid one. It should serialize it as
invalid-date
for example (NOTNaN
since we need to know that it's a date type in the snapshot).As an example of use, I experienced this while creating tests for a serializer/deserializer where I needed to save and restore invalid dates...
Link to repl or repo (highly encouraged)
https://github.com/huafu/jest-issue-demo
Run
npx envinfo --preset jest
Paste the results here:
The text was updated successfully, but these errors were encountered: