



















@@ -46,6 +46,15 @@ vi.mock("node:child_process", async () => {
46464747const spawnMock = vi.mocked(spawn);
484849+function requireSpawnArgs(index: number): string[] {
50+const args = spawnMock.mock.calls[index]?.[1] as string[] | undefined;
51+expect(args).toBeDefined();
52+if (!args) {
53+throw new Error("expected ssh spawn args");
54+}
55+return args;
56+}
57+4958let parseSshConfigOutput: typeof import("./ssh-config.js").parseSshConfigOutput;
5059let resolveSshConfig: typeof import("./ssh-config.js").resolveSshConfig;
5160@@ -81,8 +90,7 @@ describe("ssh-config", () => {
8190expect(config?.host).toBe("peters-mac-studio-1.sheep-coho.ts.net");
8291expect(config?.port).toBe(2222);
8392expect(config?.identityFiles).toEqual(["/tmp/id_ed25519"]);
84-const args = spawnMock.mock.calls[0]?.[1] as string[] | undefined;
85-expect(args?.slice(-2)).toEqual(["--", "me@alias"]);
93+expect(requireSpawnArgs(0).slice(-2)).toEqual(["--", "me@alias"]);
8694});
87958896it("adds non-default port and trimmed identity arguments", async () => {
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。