chore(test): make shell-env trusted-shell assertion platform-aware

This commit is contained in:
Vignesh Natarajan
2026-02-22 00:51:04 -08:00
parent 8e7d8c3d8e
commit 409b6a3321

View File

@@ -150,15 +150,16 @@ describe("shell env fallback", () => {
expect(exec).toHaveBeenCalledWith("/bin/sh", ["-l", "-c", "env -0"], expect.any(Object));
});
it("uses trusted absolute SHELL path when executable", () => {
it("uses trusted absolute SHELL path when executable on posix-style paths", () => {
const accessSyncSpy = vi.spyOn(fs, "accessSync").mockImplementation(() => undefined);
try {
const trustedShell = "/usr/bin/zsh-trusted";
const { res, exec } = runShellEnvFallbackForShell(trustedShell);
const expectedShell = process.platform === "win32" ? "/bin/sh" : trustedShell;
expect(res.ok).toBe(true);
expect(exec).toHaveBeenCalledTimes(1);
expect(exec).toHaveBeenCalledWith(trustedShell, ["-l", "-c", "env -0"], expect.any(Object));
expect(exec).toHaveBeenCalledWith(expectedShell, ["-l", "-c", "env -0"], expect.any(Object));
} finally {
accessSyncSpy.mockRestore();
}