Skip to content
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

@polkadot/api 7.11.1 not working with jest testing framework #4638

Closed
akileshtangella opened this issue Mar 8, 2022 · 2 comments
Closed
Labels
duplicate Support Tracks issues or requests related to troubleshooting, answering questions, and user assistance.

Comments

@akileshtangella
Copy link

I am getting the following error:
Must use import to load ES Module: [...]/node_modules/@polkadot/x-bigint/shim.js. Any insights on how to solve this would be appreciated. I tried configuring my jest config file and tsconfig.json in multiple ways, but nothing seems to work.

@akileshtangella akileshtangella changed the title polkadjot-js 7.11.1 not working with jest testing framework @polkadjot/api 7.11.1 not working with jest testing framework Mar 8, 2022
@akileshtangella akileshtangella changed the title @polkadjot/api 7.11.1 not working with jest testing framework @polkadot/api 7.11.1 not working with jest testing framework Mar 8, 2022
@jacogr
Copy link
Member

jacogr commented Mar 8, 2022

There are multiple issues on Jest, see https://github.com/polkadot-js/api/issues?q=is%3Aissue+is%3Aclosed+jest

The bottom-line is that Jest ESM support seems to be lagging behind and it pulls in ESM despite the export maps. Most of the above issues have workarounds/configurations.

EDIT: It seems the upstream Jest issue for export map support is closed (just in time for the Node 12 deprecation where it was first added) and they seem to support it in Jest 28 (only alpha for now) from my reading of jestjs/jest#9771

@jacogr jacogr added duplicate Support Tracks issues or requests related to troubleshooting, answering questions, and user assistance. labels Mar 8, 2022
@polkadot-js-bot
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue if you think you have a related problem or query.

@polkadot-js polkadot-js locked as resolved and limited conversation to collaborators Mar 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
duplicate Support Tracks issues or requests related to troubleshooting, answering questions, and user assistance.
Projects
None yet
Development

No branches or pull requests

3 participants