

























@@ -53,6 +53,14 @@ async function expectPathMissing(targetPath: string): Promise<void> {
5353throw new Error(`Expected path to be missing: ${targetPath}`);
5454}
555556+function requireFirstMockCall<T>(mock: { mock: { calls: T[][] } }, label: string): T[] {
57+const call = mock.mock.calls.at(0);
58+if (!call) {
59+throw new Error(`expected ${label} call`);
60+}
61+return call;
62+}
63+5664describe("managed npm root", () => {
5765it("keeps existing plugin dependencies when adding another managed plugin", async () => {
5866const npmRoot = await makeTempRoot();
@@ -416,7 +424,7 @@ describe("managed npm root", () => {
416424const runCommand = vi.fn().mockResolvedValue(successfulSpawn);
417425await expect(repairManagedNpmRootOpenClawPeer({ npmRoot, runCommand })).resolves.toBe(true);
418426expect(runCommand).toHaveBeenCalledTimes(1);
419-const [repairArgs, repairOptions] = runCommand.mock.calls[0];
427+const [repairArgs, repairOptions] = requireFirstMockCall(runCommand, "repair command");
420428expect(repairArgs).toEqual([
421429"npm",
422430"uninstall",
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。