Skip to content

Conversation

@Bayheck
Copy link
Collaborator

@Bayheck Bayheck commented Feb 22, 2024

Purpose

Starting from Node version 20 Hooks like load run in a separate thread, isolated from the main thread.
https://nodejs.org/docs/latest-v20.x/api/module.html#hooks.

Our current implementation relies on main thread in getTestFileCompilers.
Because the load hook is now running in a separate thread the testFileCompilers was never initialized before, and getTestFileCompilers calls initTestFileCompilers with no parameters. That is why the esm flag is lost in Node version 20 and above.

Approach

Pass the esm flag from load hook to getTestFileCompilers` in order to initialize the correct compilers.

The test 'Should import ESM without errors in ESM mode' also works for this fix in node 20 and above.

References

closes #8132

Pre-Merge TODO

  • Write tests for your proposed changes
  • Make sure that existing tests do not fail

@need-response-app need-response-app bot added the STATE: Need response An issue that requires a response or attention from the team. label Feb 22, 2024
@Bayheck Bayheck removed the STATE: Need response An issue that requires a response or attention from the team. label Feb 22, 2024
@Bayheck Bayheck marked this pull request as ready for review February 26, 2024 11:44
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.

Unable to run the tests in ESM

3 participants