test(infra): update binaries test for Windows/Unix platform detection

This commit is contained in:
ThanhNguyxn 2026-01-27 12:15:16 +07:00
parent 23af14a32d
commit 9db43df1e2

View File

@ -4,6 +4,8 @@ import type { runExec } from "../process/exec.js";
import type { RuntimeEnv } from "../runtime.js";
import { ensureBinary } from "./binaries.js";
const expectedCmd = process.platform === "win32" ? "where" : "which";
describe("ensureBinary", () => {
it("passes through when binary exists", async () => {
const exec: typeof runExec = vi.fn().mockResolvedValue({
@ -16,7 +18,7 @@ describe("ensureBinary", () => {
exit: vi.fn(),
};
await ensureBinary("node", exec, runtime);
expect(exec).toHaveBeenCalledWith("which", ["node"]);
expect(exec).toHaveBeenCalledWith(expectedCmd, ["node"]);
});
it("logs and exits when missing", async () => {