Closed ashrafnazar closed 6 months ago
Hey @ashrafnazar ,
The only thing I can spot from the stacktrace is that Jest is loading the commonjs (cjs
) version of the library. Perhaps it should load the one from the es
folder?
Regardless, it is likely an issue with your testing setup rather than an issue with the library. I am sorry but we can't assist you with that.
Cheers
Hi @ribeiroguilherme - we figured it out in the end and the fix was to add '^preact(/(.*)|$)': 'preact$1',
to moduleNameMapper
in our Jest config file. I believe this will help others, so if this could be included somewhere in your docs, it would be appreciated
Thanks for sharing your fix @ashrafnazar
This is related to your testing setup and it would not make sense for us to add into our documentation. But in case people face this problem in their setup, they can find the answer here in this thread :)
Cheers
Describe the bug We are in the process of testing an ApplePay component using Jest, but receive an error when attempting to run the test:
Where the source of the error seems to be
node_modules/preact/dist/preact.module.js:1
Further messages include:
To Reproduce Steps to reproduce the behavior:
Expected behavior Documentation on how to test such components or a solution to bypass the error.