summaryrefslogtreecommitdiff
path: root/tests/testdata/workers/node_worker_auto_exits.mjs
blob: abfb084c3a21f02bcbd171935abd02675841950a (plain)
1
2
3
4
5
6
7
8
9
import { isMainThread, Worker } from "node:worker_threads";

if (isMainThread) {
  // This re-loads the current file inside a Worker instance.
  const w = new Worker(import.meta.filename);
} else {
  console.log("Inside Worker!");
  console.log(isMainThread); // Prints 'false'.
}