jest-styled-components
jest-styled-components copied to clipboard
Tests break when testing with Jest 27
Hi guys,
I'm trying to update Jest in a NextJS project.
Using the version 26.6.3
, the tests run fine.
Then when I update Jest up to 27.0.0 I get the following error:
I've created a project that reproduces the error:
The test will fail in:
https://www.github.com/pyymenta/jest-27-styled-components
The test will pass in:
https://github.com/pyymenta/jest-27-styled-components/tree/jest-26.6.3
I noticed that Jest 27 had some breaking changes, I'm investigating it but without success yet. Any ideas?
The tests also stopped working for me. Any solution?
On my project, our tests broke with this same error. The problem was ocurring because styled-components was installed on the root of my node_modules and on the node_modules inside jest-styled-components. I solved it by adding this to my package.json and doing a clean install (rm -r node_modules && yarn install
):
"resolutions": {
"styled-components": "5.3.1",
}
Hey guys,
I fixed the problem adding the following entry in my jest configuration in package.json
file:
Branch: https://github.com/pyymenta/jest-27-styled-components/blob/jest-27-fixed/package.json#L24