






















@@ -34,6 +34,12 @@ vi.mock("../runtime.js", () => ({
3434},
3535}));
363637+function firstConfigReadyCall() {
38+return ensureConfigReadyMock.mock.calls[0]?.[0] as
39+| { runtime?: unknown; commandPath?: unknown }
40+| undefined;
41+}
42+3743describe("tryRouteCli", () => {
3844let tryRouteCli: typeof import("./route.js").tryRouteCli;
3945// Capture the same loggingState reference that route.js uses.
@@ -88,9 +94,7 @@ describe("tryRouteCli", () => {
8894await expect(tryRouteCli(["node", "openclaw", "status"])).resolves.toBe(true);
89959096expect(ensureConfigReadyMock).toHaveBeenCalledTimes(1);
91-const configReadyCall = ensureConfigReadyMock.mock.calls.at(0)?.[0] as
92-| { runtime?: unknown; commandPath?: unknown }
93-| undefined;
97+const configReadyCall = firstConfigReadyCall();
9498expect(typeof configReadyCall?.runtime).toBe("object");
9599expect(configReadyCall?.commandPath).toEqual(["status"]);
96100expect(ensurePluginRegistryLoadedMock).toHaveBeenCalledWith({
@@ -161,9 +165,7 @@ describe("tryRouteCli", () => {
161165["node", "openclaw", "--log-level", "debug", "status"],
162166);
163167expect(ensureConfigReadyMock).toHaveBeenCalledTimes(1);
164-const configReadyCall = ensureConfigReadyMock.mock.calls.at(0)?.[0] as
165-| { runtime?: unknown; commandPath?: unknown }
166-| undefined;
168+const configReadyCall = firstConfigReadyCall();
167169expect(typeof configReadyCall?.runtime).toBe("object");
168170expect(configReadyCall?.commandPath).toEqual(["status"]);
169171expect(ensurePluginRegistryLoadedMock).toHaveBeenCalledWith({
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。