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

🐞[BUG]: it seems that Ngxs is not compatible with Jest ESM #2061

Open
vojtesaak opened this issue Sep 25, 2023 · 3 comments
Open

🐞[BUG]: it seems that Ngxs is not compatible with Jest ESM #2061

vojtesaak opened this issue Sep 25, 2023 · 3 comments

Comments

@vojtesaak
Copy link

Affected Package

@ngxs/store

Description

Tests run fine without ESM. If ESM is enabled, it ends up with error at the file with the NGXS import - it fails when requiring angular.

  ● Test suite failed to run

    Must use import to load ES Module: /Users/vojtesaak/imt/ngxs-esm/node_modules/@angular/core/fesm2022/core.mjs

      at Runtime.requireModule (node_modules/jest-runtime/build/index.js:850:21)
      at node_modules/@ngxs/store/bundles/ngxs-store.umd.js:2:85
      at Object.<anonymous> (node_modules/@ngxs/store/bundles/ngxs-store.umd.js:5:3)
          at async Promise.all (index 1)

πŸ”¬ Minimal Reproduction

https://github.com/vojtesaak/ngxs-esm

  • npm run test - without error
  • npm run test-esm - error
@vojtesaak vojtesaak changed the title 🐞[BUG]: it seems Ngxs is not compatible with Jest ESM 🐞[BUG]: it seems that Ngxs is not compatible with Jest ESM Sep 25, 2023
@jase88
Copy link

jase88 commented Dec 9, 2023

Same error if using vitest with ngxs. Followed the setup here: https://dev.to/brandontroberts/faster-testing-with-angular-and-vitest-274n

So it seems to be ESM related

@hunter-isaiah96
Copy link

Still running into this error, does anyone have a fix?

node_modules/@ngxs/store/bundles/ngxs-store.umd.js:2:83
❯ Object. node_modules/@ngxs/store/bundles/ngxs-store.umd.js:5:3

@theUgluk
Copy link

theUgluk commented May 7, 2024

I am still running into this, is this something that's known? Is there a workaround?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants