























@@ -50,6 +50,16 @@ function createShellHarness(params?: {
5050};
5151}
525253+function requireSpawnOptions(spawnCommand: ReturnType<typeof vi.fn>): {
54+env?: Record<string, string>;
55+} {
56+const call = spawnCommand.mock.calls.at(0);
57+if (!call) {
58+throw new Error("expected spawn command call");
59+}
60+return call[1] as { env?: Record<string, string> };
61+}
62+5363describe("createLocalShellRunner", () => {
5464it("logs denial on subsequent ! attempts without re-prompting", async () => {
5565const harness = createShellHarness();
@@ -96,7 +106,7 @@ describe("createLocalShellRunner", () => {
9610697107expect(harness.createSelectorSpy).toHaveBeenCalledTimes(1);
98108expect(spawnCommand).toHaveBeenCalledTimes(1);
99-const spawnOptions = spawnCommand.mock.calls[0]?.[1] as { env?: Record<string, string> };
109+const spawnOptions = requireSpawnOptions(spawnCommand);
100110expect(spawnOptions.env?.OPENCLAW_SHELL).toBe("tui-local");
101111expect(spawnOptions.env?.PATH).toBe("/tmp/bin");
102112expect(harness.messages).toContain("local shell: enabled for this session");
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。