Skip to content
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

Update for compatibility with Jest 22.0.0 #3

Merged
merged 2 commits into from
Dec 18, 2017

Conversation

sgwilym
Copy link
Collaborator

@sgwilym sgwilym commented Dec 18, 2017

After updating a project using this serialiser to use Jest 22.0.0, I saw that snapshot tests were being broken by extra, nested prints of the styles.

It seems as though the serialize function Jest passes to the print function has new behaviour in Jest 22, and includes the current serialiser with it.

My solution was to reset the styles variable before creating the printed result, and to make a copy of it beforehand. This means the styles aren't printed in the subsequent serialisations in serialize(val), and gives us the added bonus of stripping some newlines where they're not necessary.

Seems that Jest uses different names for snapshots now, so they changed a lot — sorry about that! Please let me know if there's anything else that needs tidying up. Thanks!

@jaredpalmer jaredpalmer merged commit 4d42bc7 into jaredpalmer:master Dec 18, 2017
@sgwilym
Copy link
Collaborator Author

sgwilym commented Dec 19, 2017

Hey, as always thank for the speedy merge! Would it be possible to cut a new release for this?

@sgwilym sgwilym deleted the update-jest branch December 19, 2017 09:39
@jaredpalmer
Copy link
Owner

Done!

@sgwilym
Copy link
Collaborator Author

sgwilym commented Dec 19, 2017

Great, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants