aboutsummaryrefslogtreecommitdiff
path: root/test/js/node/disabled-module.test.js
blob: 7333a0f1f8cbfbf1eba9403208b609b470f31069 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import { expect, test } from "bun:test";
import * as worker_threads from "worker_threads";
import worker_threads_default from "worker_threads";

test("not implemented yet module masquerades as undefined and throws an error", () => {
  expect(typeof worker_threads.default).toBe("undefined");
  expect(typeof worker_threads_default).toBe("undefined");
  expect(typeof worker_threads.getEnvironmentData).toBe("undefined");
  expect(typeof worker_threads_default.getEnvironmentData).toBe("undefined");
});

test("esbuild functions with worker_threads stub", async () => {
  const esbuild = await import("esbuild");
  const result = await esbuild.transform('console . log( "hello world" )', { minify: true });
  expect(result.code).toBe('console.log("hello world");\n');
});