mirror of
https://github.com/oven-sh/bun
synced 2026-02-10 02:48:50 +00:00
16 lines
450 B
JavaScript
16 lines
450 B
JavaScript
import { expect, test } from "bun:test";
|
|
import { bunEnv, bunExe } from "harness";
|
|
|
|
test("Bun.isMainThread", () => {
|
|
expect(Bun.isMainThread).toBeTrue();
|
|
|
|
const { stdout, exitCode } = Bun.spawnSync({
|
|
cmd: [bunExe(), import.meta.resolveSync("./main-worker-file.js")],
|
|
stderr: "inherit",
|
|
stdout: "pipe",
|
|
env: bunEnv,
|
|
});
|
|
expect(exitCode).toBe(0);
|
|
expect(stdout.toString()).toBe("isMainThread true\nisMainThread false\n");
|
|
});
|