I'm currently trying to update to Styled Components 5.0.0 but I've had some issues that my JEST tests stops working. I've downgraded down to 4.2.1, but still updated babel@preset-react, preset-env, core and some other packages. I get this error when I try run npm test:
"Could neither find styled-components secret internals" and it points to import 'jest-styled-components'; Jest-styled-components is also updated to 7.0.0
To resolve this issue, you need to ensure that you are using the correct version of jest-styled-components that is compatible with your version of styled-components. The latest version of jest-styled-components (7.0.0) requires styled-components version 5 or above, so if you are using an older version of styled-components (like 4.2.1), you will need to use an older version of jest-styled-components that is compatible with that version.
To install a specific version of a package, you can use the @ symbol followed by the version number. For example, to install version 6.0.0 of jest-styled-components, you would run:
npm install jest-styled-components@6.0.0
You can check the compatibility between different versions of styled-components and jest-styled-components in the jest-styled-components documentation[1].
[1] https://github.com/styled-components/jest-styled-components#compatibility-with-styled-components