test(plugins): fail gauntlet on load diagnostics

This commit is contained in:
Vincent Koc
2026-05-23 08:55:44 +02:00
parent 9ff1a4371f
commit c298dfe013
3 changed files with 40 additions and 3 deletions

View File

@@ -7,6 +7,7 @@ import {
collectGatewayCpuObservations,
collectMetricObservations,
collectQaBaselineRegressionObservations,
detectCommandDiagnosticFailure,
discoverBundledPluginManifests,
schemaHasRequiredFields,
selectPluginEntries,
@@ -84,6 +85,7 @@ describe("plugin gateway gauntlet helpers", () => {
});
it("skips source-only plugin dirs that are excluded from the built runtime", async () => {
await writeManifest("qa-lab", "openclaw.plugin.json", JSON.stringify({ id: "qa-lab" }));
await writeManifest("qqbot", "openclaw.plugin.json", JSON.stringify({ id: "qqbot" }));
await writeManifest("telegram", "openclaw.plugin.json", JSON.stringify({ id: "telegram" }));
@@ -92,6 +94,22 @@ describe("plugin gateway gauntlet helpers", () => {
expect(matrix.map((entry) => entry.id)).toEqual(["telegram"]);
});
it("detects plugin load failures in successful command output", () => {
expect(
detectCommandDiagnosticFailure(
"Installed plugin: qa-lab\n",
"[plugins] qa-lab failed to load from /repo/extensions/qa-lab/index.ts: Error: nope\n",
),
).toBe("plugin-load-failure");
expect(
detectCommandDiagnosticFailure(
"",
"\u001B[36m[plugins]\u001B[39m qa-lab failed to load from /repo/extensions/qa-lab/index.ts: Error: nope\n",
),
).toBe("plugin-load-failure");
expect(detectCommandDiagnosticFailure("Installed plugin: qa-lab\n", "")).toBeNull();
});
it("selects plugin shards after explicit id filtering", () => {
const entries = ["a", "b", "c", "d"].map((id) => ({ id }));