-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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 not working with react-css-modules #1220
Comments
Seems the automocking did not work well, you could try this in your test: jest.unmock('react-css-modules'); or jest.mock('react-css-modules', () => jest.fn()); |
There is literally a link there in the error message with an explanation. Also, what @vvo said. |
I also recommend to just disable automocking for all your tests. Try |
Thanks, i have unmocked react-css-modules and updated my example. But, the error above is now replaced by another one :
Jest try to parse the stylesheet which are imported in my component (like in the official example). Do you know how to prevent it ? |
See the moduleNameMapper in the documentation for how to use Jest with webpack. http://facebook.github.io/jest/docs/tutorial-webpack.html#content |
Ah nice! |
OK it works ! Thanks for your help 👍 . Just note that it's not possible to use the
Therefore, i used the css module property instead !? I suppose that is an issue of react-css-modules. |
To follow at react-css-modules's issue num 146. |
Is there any resolution to this issue? I'm currently stuck on it and am getting nowhere. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Hello,
When a ReactJS project is setting with Webpack, Jest not working with react-css-modules.
As you will see on my example the error below appears when this command is launched :
npm run test
.Do you know how to avoid this error ?
The text was updated successfully, but these errors were encountered: