Open lapanti opened 5 years ago
@lapanti I've discovered this is not the jest-styled-components
issue but an issue in jest-plugin-styled-components
: https://github.com/styled-components/babel-plugin-styled-components/issues. I haven't found if anyone has created a bug there yet, but reverting that plugin to version 1.8.0
has fixed this issue for me.
Thank you for the idea but we don't use babel-plugin-styled-components (or have a .babelrc for that matter as we are using create-react-app) so installing it didn't help my cause :)
I found that I didn't need to revert babel-plugin-styled-components
to 1.8.0
(from 1.9.2
), but rather go back to styled-components 4.1.1
from 4.1.2
. That fixed this issue for me.
Thank you very much for opening this issue @lapanti, and thanks for your comments @Kikketer @DevanB.
@lapanti, unfortunately, I wasn't able to repro - everything seems to work as expected with CRA. Would you be able to provide a non-working repo/example?
I added
jest-styled-components
to some of our repos last week and it worked for a few days as nicely as I had hoped, but for some reason now suddenly I'm getting the hashed classnames again in snapshots instead of the styles (c0, c1 etc.). P.S.Current package.json
An example of the failing tests:
where
SectionItem
is a simple styled component