mirror of
https://github.com/oven-sh/bun
synced 2026-02-10 02:48:50 +00:00
28 lines
849 B
TypeScript
28 lines
849 B
TypeScript
import { test, expect } from "bun:test";
|
|
import { bunEnv, bunExe } from "harness";
|
|
import { join } from "path";
|
|
|
|
// This also tests __dirname and __filename
|
|
test("require.cache", () => {
|
|
const { stdout, exitCode } = Bun.spawnSync({
|
|
cmd: [bunExe(), "run", join(import.meta.dir, "require-cache-fixture.cjs")],
|
|
env: bunEnv,
|
|
stderr: "inherit",
|
|
});
|
|
|
|
expect(stdout.toString().trim().endsWith("--pass--")).toBe(true);
|
|
expect(exitCode).toBe(0);
|
|
});
|
|
|
|
// https://github.com/oven-sh/bun/issues/5188
|
|
test("require.cache does not include unevaluated modules", () => {
|
|
const { stdout, exitCode } = Bun.spawnSync({
|
|
cmd: [bunExe(), "run", join(import.meta.dir, "require-cache-bug-5188.js")],
|
|
env: bunEnv,
|
|
stderr: "inherit",
|
|
});
|
|
|
|
expect(stdout.toString().trim().endsWith("--pass--")).toBe(true);
|
|
expect(exitCode).toBe(0);
|
|
});
|