






















@@ -1125,7 +1125,7 @@ describe("uninstallPlugin", () => {
11251125path.join(runtimePeerDir, "package.json"),
11261126`${JSON.stringify({ name: "runtime-peer", version: "1.0.0" }, null, 2)}\n`,
11271127);
1128-runCommandWithTimeoutMock.mockImplementation(async (argv: string[]) => {
1128+runCommandWithTimeoutMock.mockImplementation(async (argv: string[], options?: unknown) => {
11291129if (argv[1] === "uninstall") {
11301130expect(argv).toContain("--legacy-peer-deps");
11311131await fs.rm(removedPluginDir, { recursive: true, force: true });
@@ -1146,6 +1146,22 @@ describe("uninstallPlugin", () => {
11461146termination: "exit",
11471147};
11481148}
1149+if (argv[1] === "install" && argv.includes("--package-lock-only")) {
1150+const cwd = (options as { cwd?: string } | undefined)?.cwd;
1151+expect(cwd).toBeTruthy();
1152+await fs.writeFile(
1153+path.join(cwd as string, "package-lock.json"),
1154+`${JSON.stringify({ lockfileVersion: 3, packages: { "": {} } }, null, 2)}\n`,
1155+);
1156+return {
1157+code: 0,
1158+stdout: "",
1159+stderr: "",
1160+signal: null,
1161+killed: false,
1162+termination: "exit",
1163+};
1164+}
11491165if (argv[1] === "install") {
11501166expect(argv).toContain("--legacy-peer-deps");
11511167expect(argv).toContain("--omit=peer");
@@ -1183,7 +1199,7 @@ describe("uninstallPlugin", () => {
11831199expect(rootManifest.dependencies?.["removed-plugin"]).toBeUndefined();
11841200expect(rootManifest.dependencies?.["runtime-peer"]).toBeUndefined();
11851201expect(rootManifest.openclaw?.managedPeerDependencies ?? []).not.toContain("runtime-peer");
1186-expect(runCommandWithTimeoutMock).toHaveBeenCalledTimes(2);
1202+expect(runCommandWithTimeoutMock).toHaveBeenCalledTimes(3);
11871203});
1188120411891205it("runs npm cleanup when the managed package directory is already absent", async () => {
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。