mirror of
https://github.com/oven-sh/bun
synced 2026-02-28 20:40:59 +01:00
22 lines
551 B
TypeScript
22 lines
551 B
TypeScript
import { expect, test } from "bun:test";
|
|
|
|
test("require('bun')", () => {
|
|
const str = eval("'bun'");
|
|
expect(require(str)).toBe(Bun);
|
|
});
|
|
|
|
test("await import('bun')", async () => {
|
|
const str = eval("'bun'");
|
|
const BunESM = await import(str);
|
|
|
|
// console.log it so that we iterate through all the fields and crash if it's
|
|
// in an unexpected state.
|
|
console.log(BunESM);
|
|
|
|
for (let property in Bun) {
|
|
expect(BunESM).toHaveProperty(property);
|
|
expect(BunESM[property]).toBe(Bun[property]);
|
|
}
|
|
expect(BunESM.default).toBe(Bun);
|
|
});
|