


























@@ -3,13 +3,13 @@ import path from "node:path";
33import * as tar from "tar";
44import { afterAll, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
55import { safePathSegmentHashed } from "../infra/install-safe-path.js";
6+import { resolveOpenClawPackageRootSync } from "../infra/openclaw-root.js";
67import { runCommandWithTimeout } from "../process/exec.js";
78import { expectSingleNpmInstallIgnoreScriptsCall } from "../test-utils/exec-assertions.js";
89import { expectInstallUsesIgnoreScripts } from "../test-utils/npm-spec-install-test-helpers.js";
910import { initializeGlobalHookRunner, resetGlobalHookRunner } from "./hook-runner-global.js";
1011import { createMockPluginRegistry } from "./hooks.test-helpers.js";
1112import * as installSecurityScan from "./install-security-scan.js";
12-import { resolveOpenClawPackageRootSync } from "../infra/openclaw-root.js";
1313import {
1414installPluginFromArchive,
1515installPluginFromDir,
@@ -2380,6 +2380,7 @@ describe("linkOpenClawPeerDependencies (via installPluginFromDir)", () => {
23802380it("creates a node_modules/openclaw symlink when peerDependencies declares openclaw", async () => {
23812381const { pluginDir, extensionsDir } = setupPluginInstallDirs();
23822382const fakeHostRoot = suiteTempRootTracker.makeTempDir();
2383+const run = vi.mocked(runCommandWithTimeout);
23832384resolveRootMock.mockReturnValue(fakeHostRoot);
2384238523852386writePluginWithPeerDeps(pluginDir, { openclaw: "*" });
@@ -2395,6 +2396,7 @@ describe("linkOpenClawPeerDependencies (via installPluginFromDir)", () => {
23952396const stat = fs.lstatSync(symlinkPath);
23962397expect(stat.isSymbolicLink()).toBe(true);
23972398expect(fs.realpathSync(symlinkPath)).toBe(fs.realpathSync(fakeHostRoot));
2399+expect(run).not.toHaveBeenCalled();
23982400});
2399240124002402it("does not create a symlink when peerDependencies is empty", async () => {
@@ -2415,7 +2417,7 @@ describe("linkOpenClawPeerDependencies (via installPluginFromDir)", () => {
24152417expect(fs.existsSync(symlinkPath)).toBe(false);
24162418});
241724192418-it("is idempotent — re-installing replaces an existing symlink without error", async () => {
2420+it("is idempotent - re-installing replaces an existing symlink without error", async () => {
24192421const { pluginDir, extensionsDir } = setupPluginInstallDirs();
24202422const fakeHostRoot = suiteTempRootTracker.makeTempDir();
24212423resolveRootMock.mockReturnValue(fakeHostRoot);
@@ -2426,7 +2428,7 @@ describe("linkOpenClawPeerDependencies (via installPluginFromDir)", () => {
24262428const { result: first } = await installFromDirWithWarnings({ pluginDir, extensionsDir });
24272429expect(first.ok).toBe(true);
242824302429-// Second install (update mode) — should replace symlink, not throw
2431+// Second install (update mode) should replace symlink, not throw.
24302432const { result: second, warnings } = await installFromDirWithWarnings({
24312433 pluginDir,
24322434 extensionsDir,
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。