Closed mominnawaf closed 1 year ago
Not much we can do here, my best advice would be to try jest's esm features described here https://jestjs.io/docs/ecmascript-modules or you can add build logic to compile to commonjs before tests. You might encounter further issues inside node as we use things like web-componennts, not sure how jest handles that. I know there are tools like vitest who handle this by running jsdom, maybe something like this is possible in jest as well.
Link to minimal reproducible example
/
Summary
I'm using ts-jest to run tests in my project. however, I'm getting this error.
Possible issue:: The error message indicates that Jest is encountering an unexpected token during parsing. This is often caused by the use of non-standard JavaScript syntax, or when Jest isn't configured to handle such syntax. In this case, the issue is occurring because Jest is trying to parse an ECMAScript module (i.e., a file with import and export statements), and Node.js, by default, treats files as CommonJS modules, not ECMAScript modules.
List of related npm package versions
@walletconnect/modal-sign-react