test(infra): update binaries test for Windows/Unix platform detection
This commit is contained in:
parent
23af14a32d
commit
9db43df1e2
@ -4,6 +4,8 @@ import type { runExec } from "../process/exec.js";
|
|||||||
import type { RuntimeEnv } from "../runtime.js";
|
import type { RuntimeEnv } from "../runtime.js";
|
||||||
import { ensureBinary } from "./binaries.js";
|
import { ensureBinary } from "./binaries.js";
|
||||||
|
|
||||||
|
const expectedCmd = process.platform === "win32" ? "where" : "which";
|
||||||
|
|
||||||
describe("ensureBinary", () => {
|
describe("ensureBinary", () => {
|
||||||
it("passes through when binary exists", async () => {
|
it("passes through when binary exists", async () => {
|
||||||
const exec: typeof runExec = vi.fn().mockResolvedValue({
|
const exec: typeof runExec = vi.fn().mockResolvedValue({
|
||||||
@ -16,7 +18,7 @@ describe("ensureBinary", () => {
|
|||||||
exit: vi.fn(),
|
exit: vi.fn(),
|
||||||
};
|
};
|
||||||
await ensureBinary("node", exec, runtime);
|
await ensureBinary("node", exec, runtime);
|
||||||
expect(exec).toHaveBeenCalledWith("which", ["node"]);
|
expect(exec).toHaveBeenCalledWith(expectedCmd, ["node"]);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("logs and exits when missing", async () => {
|
it("logs and exits when missing", async () => {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user