Skip to content
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

Jest test fail on upgrading the styled-components lib version from 5.3.1 to 6.1.8 #4273

Open
priyapwr7 opened this issue Mar 6, 2024 · 0 comments

Comments

@priyapwr7
Copy link

Hi All,

When I updated the styled-components library version from 5.3.1 to 6.1.8 , the jest test fail with error as mentioned below:

TypeError: p.compile is not a function

  36 |   };
  37 |   return {
> 38 |     ...rtlRender(ui, {
     |                 ^
  39 |       wrapper: AllTheProviders,
  40 |       queries: {
  41 |         ...queries,

  at d (node_modules/styled-components/dist/styled-components.cjs.js:453:13)
  at e.generateAndInjectStyles (node_modules/styled-components/dist/styled-components.cjs.js:600:85)
  at node_modules/styled-components/dist/styled-components.cjs.js:668:17
  at node_modules/styled-components/dist/styled-components.cjs.js:670:8
  at I (node_modules/styled-components/dist/styled-components.cjs.js:674:6)
  at renderWithHooks (node_modules/react-dom/cjs/react-dom.development.js:2719:157)

I have used the lib here:

import styled from 'styled-components';

export const CustomDatePicker = styled(Button)`
&& {
margin-left: 1%;
}

the jestconfig file has below properties set:

testPathIgnorePatterns: ['/node_modules/'],
transformIgnorePatterns: ['/node_modules/(?!(@UI5|lit-html|d3|internmap)).*\.js$'],
moduleNameMapper: {
'\.(css|less)$': 'identity-obj-proxy',
'axios': "axios/dist/node/axios.cjs",
},
moduleFileExtensions: ['js', 'jsx', 'ts', 'tsx'],
setupFilesAfterEnv: ['core-js', '/jestSetup.js'],
moduleDirectories: ['/node_modules', '/src'],

The app runs fine but jest tests fail Please let me know how to solve this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant