Stabilize the dashboard API backfill baseline and validate emitted plugin registry artifacts. - Align API integration-test mocks and assertions with current service contracts. - Move dist-dependent plugin registry coverage into the build test command. - Exclude the artifact-dependent test from API backfill shards. Files changed: packages/dashboard/package.json | 2 +- .../src/__tests__/chat-project-services.test.ts | 3 + .../gitlab-source-issue-reconciler.test.ts | 27 +++---- .../src/__tests__/mcp-helper-forwarding.test.ts | 44 ++++++++--- .../src/__tests__/plugin-registry-dist.test.ts | 6 ++ .../src/__tests__/process-lifecycle.test.ts | 8 +- .../register-git-github.gitlab-lifecycle.test.ts | 11 ++- .../src/__tests__/register-signal-routes.test.ts | 86 +++++++++++----------- .../routes-agent-prompt-sizes-integration.test.ts | 54 ++++++++------ .../src/__tests__/server-view-preload.test.ts | 45 +++++++---- .../task-effective-settings-route.test.ts | 12 ++- .../routes/__tests__/agent-avatar-routes.test.ts | 3 + .../mission-workflow-triage-route.test.ts | 73 +++++++++--------- .../register-settings-memory-worktrunk.test.ts | 14 +++- ...sk-workflow-routes.merge-advance-events.test.ts | 18 +++-- ...r-task-workflow-routes.runtime-fallback.test.ts | 4 +- .../__tests__/tasks-overseer-controls.test.ts | 29 ++++---- .../__tests__/tasks-planner-overseer-state.test.ts | 56 +++++++------- .../__tests__/workflow-validate-route.test.ts | 21 ++---- packages/dashboard/vitest.config.ts | 4 + 20 files changed, 307 insertions(+), 213 deletions(-) Fusion-Task-Id: FN-8095 Fusion-Task-Lineage: 8f775431-2149-433a-a8b6-e6106eab661b Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
83 lines
2.6 KiB
TypeScript
83 lines
2.6 KiB
TypeScript
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
|
|
const DASHBOARD_MODULES_WITH_BEFORE_EXIT_CLEANUP = [
|
|
"../agent-generation.js",
|
|
"../ai-refine.js",
|
|
"../planning.js",
|
|
"../subtask-breakdown.js",
|
|
"../mission-interview.js",
|
|
"../milestone-slice-interview.js",
|
|
"../server.js",
|
|
] as const;
|
|
|
|
async function importProcessLifecycle() {
|
|
return import("../process-lifecycle.js");
|
|
}
|
|
|
|
async function resetDashboardBeforeExitRegistry(): Promise<void> {
|
|
const lifecycle = await importProcessLifecycle();
|
|
lifecycle.__resetBeforeExitRegistryForTests();
|
|
}
|
|
|
|
describe("dashboard process lifecycle cleanup", () => {
|
|
beforeEach(async () => {
|
|
await resetDashboardBeforeExitRegistry();
|
|
vi.resetModules();
|
|
});
|
|
|
|
afterEach(async () => {
|
|
await resetDashboardBeforeExitRegistry();
|
|
vi.resetModules();
|
|
});
|
|
|
|
it("keeps one dashboard beforeExit listener across repeated module evaluation", async () => {
|
|
const warnings: Error[] = [];
|
|
const onWarning = (warning: Error) => {
|
|
warnings.push(warning);
|
|
};
|
|
process.on("warning", onWarning);
|
|
const baselineListeners = process.listenerCount("beforeExit");
|
|
|
|
try {
|
|
for (let iteration = 0; iteration < 15; iteration += 1) {
|
|
vi.resetModules();
|
|
for (const modulePath of DASHBOARD_MODULES_WITH_BEFORE_EXIT_CLEANUP) {
|
|
await import(modulePath);
|
|
}
|
|
}
|
|
} finally {
|
|
process.off("warning", onWarning);
|
|
}
|
|
|
|
const addedListeners = process.listenerCount("beforeExit") - baselineListeners;
|
|
/*
|
|
FNXC:DashboardProcessLifecycle 2026-07-16-08:28:
|
|
This suite owns the dashboard's beforeExit registration invariant. The host
|
|
process may independently register exit cleanup listeners, so only a
|
|
beforeExit MaxListeners warning proves this module-evaluation regression.
|
|
*/
|
|
const maxListenerWarnings = warnings.filter(
|
|
(warning) => warning.name === "MaxListenersExceededWarning" && (warning as { type?: string }).type === "beforeExit",
|
|
);
|
|
|
|
expect(addedListeners).toBeLessThanOrEqual(1);
|
|
expect(maxListenerWarnings).toEqual([]);
|
|
});
|
|
|
|
it("runs every cleanup registered behind the shared beforeExit listener", async () => {
|
|
const lifecycle = await importProcessLifecycle();
|
|
const cleanupOne = vi.fn();
|
|
const cleanupTwo = vi.fn();
|
|
|
|
lifecycle.registerBeforeExitCleanup(cleanupOne);
|
|
lifecycle.registerBeforeExitCleanup(cleanupTwo);
|
|
|
|
expect(lifecycle.__getBeforeExitCleanupCount()).toBe(2);
|
|
|
|
lifecycle.__runBeforeExitCleanupsForTests();
|
|
|
|
expect(cleanupOne).toHaveBeenCalledOnce();
|
|
expect(cleanupTwo).toHaveBeenCalledOnce();
|
|
});
|
|
});
|