





























@@ -4,6 +4,7 @@ import { pathToFileURL } from "node:url";
44import { bundledDistPluginFile } from "openclaw/plugin-sdk/test-fixtures";
55import { afterEach, describe, expect, it, vi } from "vitest";
66import { stageBundledPluginRuntime } from "../../scripts/stage-bundled-plugin-runtime.mjs";
7+import { withMockedWindowsPlatform, withRestoredMocks } from "../test-utils/vitest-spies.js";
78import { discoverOpenClawPlugins } from "./discovery.js";
89import { loadPluginManifestRegistry } from "./manifest-registry.js";
910import { cleanupTrackedTempDirs, makeTrackedTempDir } from "./test-helpers/fs-fixtures.js";
@@ -547,7 +548,6 @@ describe("stageBundledPluginRuntime", () => {
547548[bundledDistPluginFile("feishu", "assets/fixture.txt")]: "# Feishu Doc\n",
548549});
549550550-const platformSpy = vi.spyOn(process, "platform", "get").mockReturnValue("win32");
551551const realSymlinkSync = fs.symlinkSync.bind(fs);
552552const symlinkSpy = vi.spyOn(fs, "symlinkSync").mockImplementation(((target, link, type) => {
553553const linkPath = String(link);
@@ -557,7 +557,11 @@ describe("stageBundledPluginRuntime", () => {
557557return realSymlinkSync(String(target), linkPath, type);
558558}) as typeof fs.symlinkSync);
559559560-stageBundledPluginRuntime({ repoRoot });
560+withRestoredMocks([symlinkSpy], () => {
561+withMockedWindowsPlatform(() => {
562+stageBundledPluginRuntime({ repoRoot });
563+});
564+});
561565562566const runtimeAssetPath = path.join(
563567repoRoot,
@@ -569,9 +573,6 @@ describe("stageBundledPluginRuntime", () => {
569573);
570574expect(fs.lstatSync(runtimeAssetPath).isSymbolicLink()).toBe(false);
571575expect(fs.readFileSync(runtimeAssetPath, "utf8")).toBe("# Feishu Doc\n");
572-573-symlinkSpy.mockRestore();
574-platformSpy.mockRestore();
575576},
576577);
577578});
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。