mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 12:50:42 +00:00
fix(plugins): load packaged runtime mirrors from canonical sources
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { mkdtempSync, mkdirSync, rmSync, writeFileSync } from "node:fs";
|
||||
import { mkdtempSync, mkdirSync, rmSync, symlinkSync, writeFileSync } from "node:fs";
|
||||
import { tmpdir } from "node:os";
|
||||
import { dirname, join } from "node:path";
|
||||
import { describe, expect, it } from "vitest";
|
||||
@@ -12,6 +12,7 @@ import {
|
||||
collectBundledPluginRootRuntimeMirrorErrors,
|
||||
collectForbiddenPackContentPaths,
|
||||
collectInstalledBundledPluginRuntimeDepErrors,
|
||||
bundledRuntimeDependencySentinelCandidates,
|
||||
collectRootDistBundledRuntimeMirrors,
|
||||
collectForbiddenPackPaths,
|
||||
collectMissingPackPaths,
|
||||
@@ -673,3 +674,36 @@ describe("collectInstalledBundledPluginRuntimeDepErrors", () => {
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
describe("bundledRuntimeDependencySentinelCandidates", () => {
|
||||
it("checks canonical external runtime-deps roots for packed installs", () => {
|
||||
const root = mkdtempSync(join(tmpdir(), "release-check-runtime-candidates-"));
|
||||
const packageRoot = join(root, "package");
|
||||
const aliasRoot = join(root, "package-alias");
|
||||
const homeRoot = join(root, "home");
|
||||
try {
|
||||
mkdirSync(join(packageRoot, "dist", "extensions", "browser"), { recursive: true });
|
||||
writeFileSync(
|
||||
join(packageRoot, "package.json"),
|
||||
JSON.stringify({ name: "openclaw", version: "2026.4.24-beta.1" }, null, 2),
|
||||
);
|
||||
symlinkSync(packageRoot, aliasRoot, "dir");
|
||||
|
||||
const candidates = bundledRuntimeDependencySentinelCandidates(
|
||||
aliasRoot,
|
||||
"browser",
|
||||
"playwright-core",
|
||||
{ HOME: homeRoot } as NodeJS.ProcessEnv,
|
||||
);
|
||||
const externalCandidates = candidates.filter(
|
||||
(candidate) =>
|
||||
candidate.startsWith(join(homeRoot, ".openclaw", "plugin-runtime-deps")) &&
|
||||
candidate.endsWith(join("node_modules", "playwright-core", "package.json")),
|
||||
);
|
||||
|
||||
expect(externalCandidates.length).toBeGreaterThanOrEqual(2);
|
||||
} finally {
|
||||
rmSync(root, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user