mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 10:28:47 +00:00
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
23 lines
719 B
TypeScript
23 lines
719 B
TypeScript
import { describe, expect, test } from "bun:test";
|
|
import { join } from "node:path";
|
|
import "../../../harness"; // for expect().toRun()
|
|
|
|
describe("Bun.main", () => {
|
|
test("can be overridden", () => {
|
|
expect(Bun.main).toBeString();
|
|
const override = { foo: "bar" };
|
|
// types say Bun.main is a readonly string, but we want to write it
|
|
// and check it can be set to a non-string
|
|
(Bun as any).main = override;
|
|
expect(Bun.main as any).toBe(override);
|
|
});
|
|
|
|
test("override is reset when switching to a new test file", () => {
|
|
expect([
|
|
"test",
|
|
join(import.meta.dir, "bun-main-test-fixture-1.ts"),
|
|
join(import.meta.dir, "bun-main-test-fixture-2.ts"),
|
|
]).toRun();
|
|
});
|
|
});
|