mirror of
https://github.com/oven-sh/bun
synced 2026-02-10 02:48:50 +00:00
* Implement `__dirname` and `__filename`, allow direct eval in CommonJS * Fixup dirname and add test --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
16 lines
461 B
JavaScript
16 lines
461 B
JavaScript
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);
|
|
});
|