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

fix: allow for jest runs with plugin #903

Closed
wants to merge 1 commit into from
Closed

fix: allow for jest runs with plugin #903

wants to merge 1 commit into from

Conversation

vobu
Copy link
Contributor

@vobu vobu commented Oct 30, 2023

a starting point eventually

Copy link
Member

@petermuessig petermuessig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't work - the modules are ES modules and need to be imported with the dynamic import... Right now this causes an issue...

@vobu
Copy link
Contributor Author

vobu commented Oct 30, 2023

yeah, i figured. this PR was essentially just a reminder to get in done. i‘ll work on it.

@petermuessig
Copy link
Member

@vobu - the issue is a bit more complicated as the UI5 tooling is built with ESM and therefore can't be required


This can't be fixed easily in the cds-plugin-ui5 as the issue is related to jest and nodejs - jest forwarded the issue to node:

Jest issue (one of them): jestjs/jest#12286
Node issue: nodejs/node#35889 (fixed with Node.js >= 21)

After upgrading my local nodejs to 21 and using the following command line:

NODE_OPTIONS=--experimental-vm-modules jest tests/test.js

it works...

This needs to be fixed by using a newer Node.js version plus enabling the ESM support for JEST: https://jestjs.io/docs/ecmascript-modules

Maybe something to add to the documentation... So, I'll keep this PR open for now...

@petermuessig
Copy link
Member

Closing in favor of #901

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

Successfully merging this pull request may close these issues.

None yet

2 participants