Files
bun.sh/test/cli/run/run-shell.test.ts
dave caruso c177e054f5 feat!: shell will now throw on error by default (#9720)
* make the shell throw by default

* make shell default to throws(true)

* ok

* mv tests

* a

* a

* [autofix.ci] apply automated fixes

---------

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-03-31 16:13:59 -07:00

19 lines
621 B
TypeScript

import { expect, test } from "bun:test";
import { mkdirSync, realpathSync } from "fs";
import { bunEnv, bunExe } from "harness";
import { tmpdir } from "os";
import { join } from "path";
test("running a shell script works", async () => {
const dir = join(realpathSync(tmpdir()), "bun-run-shell");
mkdirSync(dir, { recursive: true });
await Bun.write(join(dir, "something.sh"), "echo wah");
let { stdout, stderr } = Bun.spawnSync({
cmd: [bunExe(), join(dir, "something.sh")],
cwd: dir,
env: bunEnv,
});
console.log(stderr.toString("utf8"));
expect(stdout.toString("utf8")).toEqual("wah\n");
});