-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
[jest-emotion] snapshots show every style changed when any html attribute or style changes #1847
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
Comments
This is actually a bug in |
Oh really? Well good luck, I am shivering with anticipation. |
I've confirmed locally that |
Ok, so I actually was mistaken - although how things are handled in jest around this are somewhat confusing. The actual snapshot is being dedented (the indentation is completely removed) but the received snapshot is not - it relies on the printer indenting it correctly based on the received arguments. And that's why I have thought it's a bug in To get back on track - the issue is here, in emotion. We don't use the received It turns out though that we are using the old serializer plugin APIs and it would be easier to fix this when using the new API. Even though it has been introduced in Jest 21 and most likely |
You probably already know, but inline snapshots require prettier to be installed for formatting which might have influenced why standard snapshots have that indenting. Just a hunch, I haven't looked into it as much as you. It sounds like you'd like me to leave this closed since you are planning on fixing it through an indirect solution (switching to the new API) in v11. Thank you for the update. |
While I'm going to address this soon on the next branch - I've started the discussion around this issue in Jest here: jestjs/jest#9863 |
And... you might also be interested that I've implemented a "fix" on our side here: #1850 |
You're damn right I'm interested. |
Current behavior:
Snapshot errors do not show only the changed styles or attributes of a styled component when using the snapshotSerializer.
To reproduce:
Here is a minimal repo I created with the snapshot failure committed. Simply install (I'm using yarn) and run
yarn test
to see it.emotion-snapshot-issue-reproduction
id
value)Expected behavior:
Snapshots should only show diff lines for the things that changed in a component. This used to be the behavior for all our tests but at some point it changed. I'm sorry I can't figure out when, despite trying.
Environment information:
react
version: ^16.12.0@emotion/core
version: ^10.0.27@emotion/styled
version: ^10.0.2jest-emotion
version: ^10.0.27The text was updated successfully, but these errors were encountered: