24 lines
738 B
TypeScript
24 lines
738 B
TypeScript
import { describe, expect, test } from "bun:test";
|
|
import { runCli } from "./runner.js";
|
|
|
|
describe("CLI runner", () => {
|
|
test("returns version output without touching the process lifecycle", async () => {
|
|
const result = await runCli(["version"]);
|
|
|
|
expect(result).toMatchObject({
|
|
stderr: "",
|
|
isError: false,
|
|
exitCode: 0
|
|
});
|
|
expect(JSON.parse(result.stdout)).toMatchObject({ name: "seal-home" });
|
|
});
|
|
|
|
test("returns diagnostics and a non-zero exit code for invalid commands", async () => {
|
|
const result = await runCli(["not-a-command"]);
|
|
|
|
expect(result.isError).toBe(true);
|
|
expect(result.exitCode).toBe(1);
|
|
expect(result.stderr).toContain("Unknown command: not-a-command");
|
|
});
|
|
});
|