-
-
Notifications
You must be signed in to change notification settings - Fork 145
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
Doesn't seem to support Jest 28 and newest #429
Comments
Same issue here |
Getting the same issue with jest 29.x. |
In our case (although we use it project-wide) the solution was to:
// config/jest/styledComponentsSerializer.js
const serializer = require('jest-styled-components').styleSheetSerializer
module.exports = serializer
"snapshotSerializers": [
"enzyme-to-json/serializer",
"<rootDir>/config/jest/styledComponentsSerializer",
], |
@probablyup we've noticed that snapshotting with styled-components v6 + jest-styled-components is entirely broken, do you have any suggestions? This makes testing styled-components rather tricky |
Could be due to something with the new version of stylis |
Unsure if it's related, but after trying to upgrade to SC6, both this breaks as well as styles in general (I can't use |
Thanks for the callout, I found one bug that I patched and shipped as There is a second issue with v6 where stylis is not rendering a space character where it used to... seeing if I can handle that in the library here so people don't need to adjust their assertions. |
@buugaaga it's hard to tell from your bug report but if you're on styled-components v6 I think the 6.0.9 upgrade will fix that bug you're seeing and the jest version might potentially be a red herring |
I have tried upgrading Jest from 27 to 28 and it seems that jest-styled-components doesn't do anything after the upgrade.
I have code similar to your examples
But the snapshot still have the dynamic classname from styled-components and doesn't include the actual styles:
The text was updated successfully, but these errors were encountered: