fix(ci): fix test failures from recent feature additions
- Add ChatStore mock to all dashboard route tests that mock @fusion/core, since server.ts now instantiates ChatStore(store.getFusionDir(), ...) - Add getFusionDir to createMockStore in server.test.ts - Gate AI session cleanup scheduling behind shouldScheduleAiSessionCleanup() (returns false in test env) to prevent open handle warnings - Fix desktop tests: DASHBOARD_URL is now exported as a function alias, update assertions to call DASHBOARD_URL() instead of using as string - Add node:os mocks to system-metrics.test.ts for deterministic results - Replace hardcoded maxWorkers=16 with availableParallelism()-based calculation in all vitest configs to prevent OOM on 2-core CI runners - Add --workspace-concurrency=2 to pnpm test commands - Fix TaskCard tests: update mission badge title assertions to full titles - Remove unused /api/mesh/state route - Fix plugin-auto-label: add isError field, async onTaskCreated, "tests" keyword - Fix plugin-ci-status: add module-level logger, tighten test assertions Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -153,8 +153,7 @@ describe("ci-status plugin", () => {
|
||||
|
||||
await plugin.hooks.onUnload?.();
|
||||
|
||||
// Should log that plugin is shutting down (logged as part of onUnload)
|
||||
expect(ctx.logger.info).toHaveBeenCalled();
|
||||
expect(ctx.logger.info).toHaveBeenCalledWith("CI Status plugin unloaded");
|
||||
});
|
||||
});
|
||||
|
||||
@@ -297,9 +296,15 @@ describe("ci-status plugin", () => {
|
||||
(r) => r.method === "GET" && r.path === "/status/:branch",
|
||||
)!;
|
||||
|
||||
await expect(
|
||||
route.handler(req as any, ctx as any),
|
||||
).rejects.toThrow("Branch not found");
|
||||
expect(() => route.handler(req as any, ctx as any)).toThrow(
|
||||
"Branch not found",
|
||||
);
|
||||
|
||||
try {
|
||||
route.handler(req as any, ctx as any);
|
||||
} catch (error) {
|
||||
expect((error as { statusCode?: number }).statusCode).toBe(404);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -42,6 +42,7 @@ const settingsSchema: Record<string, PluginSettingSchema> = {
|
||||
|
||||
const branchStatuses = new Map<string, BranchStatus>();
|
||||
let pollInterval: ReturnType<typeof setInterval> | null = null;
|
||||
let pluginLogger: PluginContext["logger"] | null = null;
|
||||
|
||||
// ── CI Polling Logic ───────────────────────────────────────────────────────────
|
||||
|
||||
@@ -180,6 +181,7 @@ const plugin: FusionPlugin = definePlugin({
|
||||
routes,
|
||||
hooks: {
|
||||
onLoad: (ctx) => {
|
||||
pluginLogger = ctx.logger;
|
||||
ctx.logger.info("CI Status plugin loaded");
|
||||
|
||||
const pollIntervalMs = (ctx.settings.pollIntervalMs as number) || 30000;
|
||||
@@ -206,6 +208,8 @@ const plugin: FusionPlugin = definePlugin({
|
||||
}
|
||||
// Clear branch statuses on unload
|
||||
branchStatuses.clear();
|
||||
pluginLogger?.info("CI Status plugin unloaded");
|
||||
pluginLogger = null;
|
||||
},
|
||||
|
||||
onTaskMoved: (task, fromColumn, toColumn, ctx) => {
|
||||
|
||||
Reference in New Issue
Block a user