chore: format to 2-space and bump changelog

This commit is contained in:
Peter Steinberger
2025-11-26 00:53:53 +01:00
parent a67f4db5e2
commit e5f677803f
81 changed files with 7086 additions and 6999 deletions

View File

@@ -5,34 +5,34 @@ import type { RuntimeEnv } from "../runtime.js";
import { ensureBinary } from "./binaries.js";
describe("ensureBinary", () => {
it("passes through when binary exists", async () => {
const exec: typeof runExec = vi.fn().mockResolvedValue({
stdout: "",
stderr: "",
});
const runtime: RuntimeEnv = {
log: vi.fn(),
error: vi.fn(),
exit: vi.fn(),
};
await ensureBinary("node", exec, runtime);
expect(exec).toHaveBeenCalledWith("which", ["node"]);
});
it("passes through when binary exists", async () => {
const exec: typeof runExec = vi.fn().mockResolvedValue({
stdout: "",
stderr: "",
});
const runtime: RuntimeEnv = {
log: vi.fn(),
error: vi.fn(),
exit: vi.fn(),
};
await ensureBinary("node", exec, runtime);
expect(exec).toHaveBeenCalledWith("which", ["node"]);
});
it("logs and exits when missing", async () => {
const exec: typeof runExec = vi
.fn()
.mockRejectedValue(new Error("missing"));
const error = vi.fn();
const exit = vi.fn(() => {
throw new Error("exit");
});
await expect(
ensureBinary("ghost", exec, { log: vi.fn(), error, exit }),
).rejects.toThrow("exit");
expect(error).toHaveBeenCalledWith(
"Missing required binary: ghost. Please install it.",
);
expect(exit).toHaveBeenCalledWith(1);
});
it("logs and exits when missing", async () => {
const exec: typeof runExec = vi
.fn()
.mockRejectedValue(new Error("missing"));
const error = vi.fn();
const exit = vi.fn(() => {
throw new Error("exit");
});
await expect(
ensureBinary("ghost", exec, { log: vi.fn(), error, exit }),
).rejects.toThrow("exit");
expect(error).toHaveBeenCalledWith(
"Missing required binary: ghost. Please install it.",
);
expect(exit).toHaveBeenCalledWith(1);
});
});