fix(ticket116): isoler crash plugin hello-plugin + erreur explicite UI

This commit is contained in:
2026-07-31 14:17:56 +02:00
parent e042ced724
commit d4e61a86f0
9 changed files with 417 additions and 64 deletions

View File

@ -195,6 +195,39 @@ describe("loadPlugins", () => {
expect((globalThis as Record<string, unknown>).__helloArchiveCommandRan).toBe(true);
});
it("confines a malformed runtime catalog entry and still loads healthy plugins", async () => {
const bundle = dataUrl(`
export function activate(ctx) {
globalThis.__healthyPluginActivated = ctx.pluginId;
}
`);
const { registry, failures } = await loadPlugins(
[
null,
entry({
id: "dev.acme.healthy",
displayName: "Healthy",
bundleUrl: bundle,
contributes: {
menus: [null],
menuItems: [null, { id: "x", targetMenuId: "panels", label: "X" }],
layouts: [null, { label: "Missing type" }],
} as unknown as PluginContributionDto,
}),
] as unknown as PluginRuntimePlugin[],
gateways,
);
expect(registry.list().map((p) => p.pluginId)).toEqual(["dev.acme.healthy"]);
expect(failures).toEqual([
{ pluginId: "<unknown-plugin>", reason: expect.stringContaining("bundle URL") },
]);
expect((globalThis as Record<string, unknown>).__healthyPluginActivated).toBe(
"dev.acme.healthy",
);
});
it("calls dispose() on removal (best-effort)", async () => {
const bundle = dataUrl(`
export function activate(ctx) {