Files
bun.sh/test/js/third_party/st/st.test.ts
Jarred Sumner 2e02d9de28 Use ReadableStream.prototype.* in tests instead of new Response(...).* (#20937)
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>
2025-07-14 00:47:53 -07:00

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);
});