-
-
Notifications
You must be signed in to change notification settings - Fork 17
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 `Cannot find module 'react-compare-slider' (v3.X) #144
Comments
Thanks for opening this @stevebutler2210. v3 dropped the CommonJS exports and now only provides ES modules so the issue is probably to do with that. Are you using any build system on top of Jest like typescript-eslint, custom Webpack setup, etc? |
Hey @nerdyman, thanks for the speedy response. We're using Next JS, so it's using webpack, but we've not really done much customisation of the setup etc |
Thanks @stevebutler2210. I'll spin up a Next project and see if I can repro. Do you know which node and next versions you're using? |
Thanks @nerdyman, that would be great! I'm running on Next |
Good news is I can repro this but I'm not sure how to resolve it yet. I'd rather not start publishing CommonJS modules again just to appease Jest but ESM support isn't there yet jestjs/jest#9430. I'll try some stuff out and if all else fails I'll add CJS modules back to the package. |
This should be resolved in v4. I need to do testing on other devices before doing a final release but there is a pre-release with the CJS modules published. It can be installed by running: pnpm i react-compare-slider@beta
# Or
yarn add react-compare-slider@beta
# Or
npm i react-compare-slider@beta |
Running version 3.X of the package is working fine in Storybook etc, however when we come to write tests for our component, we get the following error:
Reproduction
The component
Failing test
Expected Behaviour
A test using a component that utilises
react-compare-slider
should run without errors, using version 3.X of the library.Actual Behaviour
When running version 3.X (tested
3.1.0
and3.0.1
), the above error occurs when running a jest test for a component that uses the library.Downgrading to version
2.2.0
resolves the issue.The text was updated successfully, but these errors were encountered: