mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-11 03:42:55 +00:00
fix(update): avoid duplicate plugin smoke failures
This commit is contained in:
committed by
Peter Steinberger
parent
d7361eff66
commit
342bde2af6
@@ -155,6 +155,7 @@ describe("runPluginPayloadSmokeCheck", () => {
|
||||
await writePackage(dir, {
|
||||
name: "@openclaw/brave-plugin",
|
||||
openclaw: { extensions: ["./index.js", " "] },
|
||||
main: "main.js",
|
||||
});
|
||||
await fs.writeFile(path.join(dir, "index.js"), "export default {};\n", "utf8");
|
||||
const result = await runPluginPayloadSmokeCheck({
|
||||
@@ -172,6 +173,50 @@ describe("runPluginPayloadSmokeCheck", () => {
|
||||
]);
|
||||
});
|
||||
|
||||
it("reports only extension-entry failure for an empty extensions list even if main is missing", async () => {
|
||||
const dir = path.join(tmpRoot, "brave-empty");
|
||||
await writePackage(dir, {
|
||||
name: "@openclaw/brave-plugin",
|
||||
openclaw: { extensions: [] },
|
||||
main: "dist/index.js",
|
||||
});
|
||||
const result = await runPluginPayloadSmokeCheck({
|
||||
records: { brave: { source: "npm", installPath: dir } },
|
||||
env: {},
|
||||
});
|
||||
expect(result.failures).toStrictEqual([
|
||||
{
|
||||
pluginId: "brave",
|
||||
installPath: dir,
|
||||
reason: "missing-extension-entry",
|
||||
detail:
|
||||
"Plugin extension entry validation failed: package.json openclaw.extensions is empty",
|
||||
},
|
||||
]);
|
||||
});
|
||||
|
||||
it("reports missing main entry when extension entries are valid", async () => {
|
||||
const dir = path.join(tmpRoot, "brave");
|
||||
await writePackage(dir, {
|
||||
name: "@openclaw/brave-plugin",
|
||||
openclaw: { extensions: ["./index.js"] },
|
||||
main: "dist/index.js",
|
||||
});
|
||||
await fs.writeFile(path.join(dir, "index.js"), "export default {};\n", "utf8");
|
||||
const result = await runPluginPayloadSmokeCheck({
|
||||
records: { brave: { source: "npm", installPath: dir } },
|
||||
env: {},
|
||||
});
|
||||
expect(result.failures).toStrictEqual([
|
||||
{
|
||||
pluginId: "brave",
|
||||
installPath: dir,
|
||||
reason: "missing-main-entry",
|
||||
detail: `Plugin main entry "dist/index.js" not found at ${path.join(dir, "dist/index.js")}`,
|
||||
},
|
||||
]);
|
||||
});
|
||||
|
||||
it("accepts a packaged TypeScript extension entry when compiled runtime output exists", async () => {
|
||||
const dir = path.join(tmpRoot, "codex");
|
||||
await writePackage(dir, {
|
||||
|
||||
@@ -129,6 +129,7 @@ export async function runPluginPayloadSmokeCheck(params: {
|
||||
: "package.json openclaw.extensions is empty"
|
||||
}`,
|
||||
});
|
||||
continue;
|
||||
} else if (extensionResolution.status === "ok") {
|
||||
const extensionValidation = await validatePackageExtensionEntriesForInstall({
|
||||
packageDir: installPath,
|
||||
|
||||
Reference in New Issue
Block a user