summaryrefslogtreecommitdiff
path: root/tests/specs/node/worker_threads_cache/main.ts
diff options
context:
space:
mode:
Diffstat (limited to 'tests/specs/node/worker_threads_cache/main.ts')
-rw-r--r--tests/specs/node/worker_threads_cache/main.ts13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/specs/node/worker_threads_cache/main.ts b/tests/specs/node/worker_threads_cache/main.ts
new file mode 100644
index 000000000..9703ac8f6
--- /dev/null
+++ b/tests/specs/node/worker_threads_cache/main.ts
@@ -0,0 +1,13 @@
+import fs from "node:fs/promises";
+import { isMainThread, Worker } from "node:worker_threads";
+
+await fs.writeFile("mod.mjs", "export default " + isMainThread);
+
+const path = new URL("mod.mjs", import.meta.url);
+const i = await import(path.href);
+console.log(i);
+
+if (isMainThread) {
+ const worker = new Worker(new URL("main.ts", import.meta.url));
+ worker.on("message", (msg) => console.log(msg));
+}