test: stabilize invoke-system-run env-wrapper assertion on Windows

This commit is contained in:
Peter Steinberger
2026-02-24 03:02:32 +00:00
parent d0ef4c75c7
commit 60f1d1959a

View File

@@ -120,12 +120,25 @@ describe("handleSystemRunInvoke mac app exec host routing", () => {
); );
}); });
it("runs canonical argv in allowlist mode for transparent env wrappers", async () => { it("handles transparent env wrappers in allowlist mode", async () => {
const { runCommand, sendInvokeResult } = await runSystemInvoke({ const { runCommand, sendInvokeResult } = await runSystemInvoke({
preferMacAppExecHost: false, preferMacAppExecHost: false,
security: "allowlist", security: "allowlist",
command: ["env", "tr", "a", "b"], command: ["env", "tr", "a", "b"],
}); });
if (process.platform === "win32") {
expect(runCommand).not.toHaveBeenCalled();
expect(sendInvokeResult).toHaveBeenCalledWith(
expect.objectContaining({
ok: false,
error: expect.objectContaining({
message: expect.stringContaining("allowlist miss"),
}),
}),
);
return;
}
expect(runCommand).toHaveBeenCalledWith(["tr", "a", "b"], undefined, undefined, undefined); expect(runCommand).toHaveBeenCalledWith(["tr", "a", "b"], undefined, undefined, undefined);
expect(sendInvokeResult).toHaveBeenCalledWith( expect(sendInvokeResult).toHaveBeenCalledWith(
expect.objectContaining({ expect.objectContaining({