




























@@ -80,6 +80,14 @@ function runPtyFallback(warnings: string[] = []) {
8080});
8181}
828283+function spawnInput(index: number): SpawnInput {
84+const call = supervisorSpawnMock.mock.calls[index] as [SpawnInput] | undefined;
85+if (!call) {
86+throw new Error(`expected supervisor spawn call ${index}`);
87+}
88+return call[0];
89+}
90+8391test("exec falls back when PTY spawn fails", async () => {
8492supervisorSpawnMock
8593.mockRejectedValueOnce(new Error("pty spawn failed"))
@@ -92,10 +100,8 @@ test("exec falls back when PTY spawn fails", async () => {
92100expect(outcome.status).toBe("completed");
93101expect(outcome.aggregated).toContain("ok");
94102expect(warnings.join("\n")).toContain("PTY spawn failed");
95-const firstSpawnInput = supervisorSpawnMock.mock.calls.at(0)?.[0] as SpawnInput | undefined;
96-const secondSpawnInput = supervisorSpawnMock.mock.calls.at(1)?.[0] as SpawnInput | undefined;
97-expect(firstSpawnInput?.mode).toBe("pty");
98-expect(secondSpawnInput?.mode).toBe("child");
103+expect(spawnInput(0).mode).toBe("pty");
104+expect(spawnInput(1).mode).toBe("child");
99105});
100106101107test("exec cleans session state when PTY fallback spawn also fails", async () => {
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。