Closed ChrisVilches closed 2 months ago
I faced the same issue when I was running the test case using Jest with Storybook.
Simply adding "transformIgnorePatterns": ["/node_modules(?!/react-movable)/"]
in jest configuration in Package.json solved my problem.
Jest is just difficult with pure ESM modules. I recommend using vitest
. @kunalphaltankar workaround is also fine.
When including this library in a React component using Next.js, this error appears:
This hadn't happened to me with any of the many other libraries I had imported in the frontend of my project.
To be honest I'm not sure what would be the solution here. Maybe re-arrange the way files are exported/imported inside the library.
Current Workaround
In my
jest.config.mjs
file, I changed the way the config is exported. Note that in Next.js the convention is to usenextJest
to generate the configuration object, and to export an async function.Then run Jest and it works.