mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 10:28:47 +00:00
Co-authored-by: Jarred-Sumner <709451+Jarred-Sumner@users.noreply.github.com> Co-authored-by: Alistair Smith <hi@alistair.sh> Co-authored-by: Claude Bot <claude-bot@bun.sh> Co-authored-by: Claude <noreply@anthropic.com>
23 lines
692 B
TypeScript
23 lines
692 B
TypeScript
import { expect, it } from "bun:test";
|
|
import { bunEnv, bunExe } from "harness";
|
|
import { dirname, join } from "node:path";
|
|
|
|
it("works", async () => {
|
|
const fixture_path = join(import.meta.dirname, "st.fixture.ts");
|
|
const fixture_data = await Bun.file(fixture_path).text();
|
|
let { stdout, stderr, exited } = Bun.spawn({
|
|
cmd: [bunExe(), "run", fixture_path],
|
|
cwd: dirname(fixture_path),
|
|
stdout: "pipe",
|
|
stdin: "ignore",
|
|
stderr: "pipe",
|
|
env: bunEnv,
|
|
});
|
|
let [code, err, out] = await Promise.all([exited, stderr.text(), stdout.text()]);
|
|
if (code !== 0) {
|
|
expect(err).toBeEmpty();
|
|
}
|
|
expect(out).toEqual(fixture_data + "\n");
|
|
expect(code).toBe(0);
|
|
});
|