-
Notifications
You must be signed in to change notification settings - Fork 139
Closed
Description
Description
Issue
I wan't to get testdouble working on Node.js v20.0.0
Node.js v20.0.0 introduces a segregation of loader code and production code
In the changelog, they call it "Loader hooks are executed off the main thread" (https://nodejs.org/api/esm.html#modules-ecmascript-modules)
With this segregation, it is only possible to communicate via a messagePort with the loader. But this only allows to send copied values, no shared objects or modules.
Is there a way to run testdouble.js with Node v20.0.0?
Environment
-
node -voutput: v20.0.0 -
npm -v(oryarn --version) output: npm 9.6.4 -
npm ls testdouble(oryarn list testdouble) version: testdouble@3.17.2
Failing Test
Example Repo
// test.js
import * as td from 'testdouble';
await td.replaceEsm('./foo.js', { foo: () => "foomocked" });
const { print } = await import("./other.js");
print();// other.js
import { foo } from "./foo.js";
export function print() {
console.log("imported", foo());
}// foo.js
export const foo = () => "foo.js"Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels