score:1
i was finally able to get the same error as you! in this codesandbox
so the issue is in the naming of styled-component files. you name them [something].css.jsx
.
and in you jest.config file tries to map them as classes or something like that, i assume it is because of the import as it ends with '.css'
...
modulenamemapper: {
"\\.(css|less|scss|sass)$": "identity-obj-proxy"
},
...
there are a couple of things you can do here.
- change naming convention for styled-components. from
[something].css.jsx
to[something].styled.jsx
. - remove
modulenamemapper
- remove
css
frommodulenamemapper
my personal favorite is option 1.
Source: stackoverflow.com
Related Query
- Jest, Enzyme and Styled Component not working with Warning: React.createElement
- How to mock React component methods with jest and enzyme
- How to read console.log from a mounted component with Enzyme and Jest in Create React App
- Testing debounced function in React component with Jest and Enzyme
- _this.store.getState is not a function when testing react component with enzyme and mocha
- React testing state of component with Jest and Enzyme
- How to check the value of a nested React component in a unit test with Enzyme and Jest
- How to test styles and media queries rendered by a React component with Jest and/or Enzyme
- Test an whole table React component cells with jest and Enzyme
- How to mock React component events with jest and enzyme
- React button component with a conditional is not working and displaying
- CSS Transition not working with react and styled components
- Mock a custom service with jest and enzyme for a react component
- Testing component created using styled component with jest and enzyme
- Testing component function in React with Enzyme and Jest
- react scroll with styled component is not working
- React styled component media query not working with child elements?
- Jest enzyme mock function not working with toHaveBeenCalled and mock.calls.length
- React hook useRef not working with styled-components and typescript
- Spying on React functional component method with jest and enzyme; Cannot spyOn on a primitive value
- React Enzyme Jest test component with className
- Mock React useRef or a function inside a functional component with enzyme and jest?
- How to test default props functions is attached to component or not ? | React | Jest | Enzyme
- How to mock a React component lifecycle method with Jest and Enzyme?
- Media queries not working with styled components in React App
- React render not working with createElement
- Testing component with react-router v4, Jest and Enzyme
- Test with Mocha and Enzyme a React component that uses React CSS Modules
- Jest enzyme shallow test is not rendering all elements of the React component
- Adding active class with styled component not working
More Query from same tag
- How to iterate over different variables/states to create an object?
- React Router v4 routes not working
- Type error when using onMutate in react query (Optimistic Updates)
- ExpressJS backed with mix of ejs and React frontend
- React router only show Navigation component if the current path is on any of the valid routes
- Lighthouse: Speed Index - Invalid score for speed-index: NaN
- React Keyup event on document within react lifesycle
- how to set the width of modal of react-responsive-modal?
- change a string into a list of select in react
- React, React Router and Flux: “dispatch in the middle of a dispatch” when I try to clear the messages on store
- React wrapper to return child on <Route> component
- useEffect renders more than once even with empty dependency list
- firebase.auth().onAuthStateChanged looping infinitely
- What is the different ReactDOM.findDOMNode(this.refs.a) vs this.refs.a?
- what is the terminal command in windows for creating a react ionic app with Cordova ? I tried searching but didn't get anything
- How can I show the updated state?
- Webpack error due to ES2015 template literal - "Unterminated string constant"
- How to make correct loop of JSON in React
- Material UI - Slider: Display only the lowest and the highest markLabel
- How to center a div while using transition and transform with scale
- Avoid entering backend url manually
- Is it possible to resolve imported module path at compile time in Webpack?
- Make table scroll with selected table row with onKeyDown (React)
- Redirect to a specific page after successful action - Redux saga
- I'm trying to create an alternative color palette, using MUI, where according to the api it changes the background of my card
- react.js Replace img src onerror
- Can't get state in return area
- Is something am i missing while creating an React app?
- Pass prop value as a parameter in an arrow function in an event handler onClick() in React
- React useParams undefined for editing user profile