-
Notifications
You must be signed in to change notification settings - Fork 39
test: added proof test for cjs with esm loader #2208
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
base: main
Are you sure you want to change the base?
Conversation
|
| const { retry } = require('../../../../../core/test/test_util'); | ||
|
|
||
| const mochaSuiteFn = | ||
| supportedVersion(process.versions.node) && semver.satisfies(process.versions.node, '18') ? describe : describe.skip; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| supportedVersion(process.versions.node) && semver.satisfies(process.versions.node, '18') ? describe : describe.skip; | |
| supportedVersion(process.versions.node) && semver.gte(process.versions.node, '18.19.0') ? describe : describe.skip; |
This test will fail for the latest v18.x releases because --experimental-loader with esm-loader.mjs is supported only up to Node.js v18.18. From v18.19 onward, the loader mechanism changes and requires using --import together with esm-register.mjs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will just run on < 18.19 then for now 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can add --import case soon. I will leave PR open
| useGlobalAgent: true, | ||
| dirname: __dirname, | ||
| enableOtelIntegration: true, | ||
| execArgv: ['--experimental-loader', `${rootFolder}/esm-loader.mjs`] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| execArgv: ['--experimental-loader', `${rootFolder}/esm-loader.mjs`] | |
| execArgv: ['--import', `${rootFolder}/esm-register.mjs`] |
I suggest updating the test to target >= v18.19 and use --import together with esm-register.mjs, since this aligns with the supported syntax from that version onward.
The old loader approach is already deprecated in v5 and does not work on above v18.19, so relying on the --import setup is the correct and future-proof option.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need both, I had no time to add the other case
aryamohanan
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really nice to see this test. ❤️



No description provided.