


























@@ -51,7 +51,16 @@ async function runMcpCommand(args: string[]) {
5151}
52525353function lastLogLine(): string {
54-return String(mockLog.mock.calls.at(-1)?.[0] ?? "");
54+return lastRuntimeLine(mockLog);
55+}
56+57+function lastErrorLine(): string {
58+return lastRuntimeLine(mockError);
59+}
60+61+function lastRuntimeLine(mock: typeof mockLog): string {
62+const call = mock.mock.calls[mock.mock.calls.length - 1];
63+return String(call?.[0] ?? "");
5564}
56655766describe("mcp cli", () => {
@@ -94,8 +103,7 @@ describe("mcp cli", () => {
94103vi.spyOn(process, "cwd").mockReturnValue(workspaceDir);
9510496105await expect(runMcpCommand(["mcp", "unset", "missing"])).rejects.toThrow("__exit__:1");
97-const errorLine = String(mockError.mock.calls.at(-1)?.[0] ?? "");
98-expect(errorLine).toBe(
106+expect(lastErrorLine()).toBe(
99107`No MCP server named "missing" in ${configPath}. Run openclaw mcp list to see configured servers.`,
100108);
101109});
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。