Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
<!-- Thank you for your contribution. Before making a PR, please read our contributing guidelines at https://github.com/DevExpress/testcafe/blob/master/CONTRIBUTING.md#code-contribution We recommend creating a *draft* PR, so that you can mark it as 'ready for review' when you are done. --> ## 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](#8132) ## Pre-Merge TODO - [ ] Write tests for your proposed changes - [ ] Make sure that existing tests do not fail Co-authored-by: Bayheck <[email protected]>
- Loading branch information