





















@@ -94,6 +94,14 @@ describe("shell env fallback", () => {
9494}
9595}
969697+function requireExecCall(exec: ReturnType<typeof vi.fn>): unknown[] {
98+const call = exec.mock.calls.at(0);
99+if (!call) {
100+throw new Error("expected shell env exec call");
101+}
102+return call;
103+}
104+97105function getShellPathTwiceWithExec(params: {
98106exec: ReturnType<typeof vi.fn>;
99107platform: NodeJS.Platform;
@@ -114,7 +122,7 @@ describe("shell env fallback", () => {
114122115123function expectBinShFallbackExec(exec: ReturnType<typeof vi.fn>) {
116124expect(exec).toHaveBeenCalledTimes(1);
117-const [shell, args, options] = exec.mock.calls[0] as unknown[];
125+const [shell, args, options] = requireExecCall(exec);
118126expect(shell).toBe("/bin/sh");
119127expect(args).toStrictEqual(["-l", "-c", "env -0"]);
120128expect((options as { windowsHide?: unknown } | undefined)?.windowsHide).toBe(true);
@@ -427,7 +435,7 @@ describe("shell env fallback", () => {
427435428436expect(res.ok).toBe(true);
429437expect(exec).toHaveBeenCalledTimes(1);
430-const [shell, args, options] = exec.mock.calls[0] as unknown[];
438+const [shell, args, options] = requireExecCall(exec);
431439expect(shell).toBe(trustedShell);
432440expect(args).toStrictEqual(["-l", "-c", "env -0"]);
433441expect((options as { windowsHide?: unknown } | undefined)?.windowsHide).toBe(true);
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。