mirror of
https://github.com/oven-sh/bun
synced 2026-02-10 02:48:50 +00:00
Co-authored-by: nektro <nektro@users.noreply.github.com> Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
17 lines
553 B
TypeScript
17 lines
553 B
TypeScript
import { expect, test } from "bun:test";
|
|
import { mkdirSync } from "fs";
|
|
import { bunEnv, bunExe, tmpdirSync } from "harness";
|
|
import { join } from "path";
|
|
|
|
test("running a commonjs module works", async () => {
|
|
const dir = tmpdirSync();
|
|
mkdirSync(dir, { recursive: true });
|
|
await Bun.write(join(dir, "index1.js"), "module.exports = 1; console.log('hello world');");
|
|
let { stdout } = Bun.spawnSync({
|
|
cmd: [bunExe(), join(dir, "index1.js")],
|
|
cwd: dir,
|
|
env: bunEnv,
|
|
});
|
|
expect(stdout.toString("utf8")).toEqual("hello world\n");
|
|
});
|