node/test/fixtures/es-module-loaders/loader-edge-cases.mjs
Jacob Smith 4667b07cd2
esm: move hook execution to separate thread
PR-URL: https://github.com/nodejs/node/pull/44710
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
Co-authored-by: Geoffrey Booth <webadmin@geoffreybooth.com>
Co-authored-by: Michaël Zasso <targos@protonmail.com>
2023-04-13 09:35:17 +02:00

13 lines
516 B
JavaScript

import { strictEqual } from "node:assert";
import { isMainThread, workerData, parentPort } from "node:worker_threads";
strictEqual(isMainThread, false);
// We want to make sure that internals are not leaked on the public module:
strictEqual(workerData, null);
strictEqual(parentPort, null);
// We don't want `import.meta.resolve` being available from loaders
// as the sync implementation is not compatible with calling async
// functions on the same thread.
strictEqual(typeof import.meta.resolve, 'undefined');