feat(KB-648): enable parallel test execution and optimize test performance

- Optimize backup tests using fake timers instead of real timeouts

- Enable parallel file execution in core, engine, CLI, and dashboard packages

- Add inline test helpers to reduce dependencies in dashboard routes tests

- Update executor tests with exact command matching and improved assertions

- Update AGENTS.md with test optimization patterns (fake timers, unique temp dirs)
This commit is contained in:
gsxdsm
2026-04-01 06:54:50 -07:00
parent e21ea42d45
commit fa37de1bed
79 changed files with 1568 additions and 7618 deletions

View File

@@ -3,7 +3,7 @@ import { PrCommentHandler } from "./pr-comment-handler.js";
import type { TaskStore, Task } from "@fusion/core";
const mockStore = {
addComment: vi.fn<(id: string, text: string, author?: "user" | "agent") => Promise<Task>>(),
addSteeringComment: vi.fn<(id: string, text: string, author?: "user" | "agent") => Promise<Task>>(),
createTask: vi.fn<(input: Parameters<TaskStore["createTask"]>[0]) => Promise<Task>>().mockResolvedValue({ id: "FN-123" } as Task),
} as unknown as TaskStore;
@@ -49,7 +49,7 @@ describe("PrCommentHandler", () => {
},
]);
expect(mockStore.addComment).not.toHaveBeenCalled();
expect(mockStore.addSteeringComment).not.toHaveBeenCalled();
});
});
@@ -77,7 +77,7 @@ describe("PrCommentHandler", () => {
},
]);
expect(mockStore.addComment).toHaveBeenCalled();
expect(mockStore.addSteeringComment).toHaveBeenCalled();
});
});
@@ -94,7 +94,7 @@ describe("PrCommentHandler", () => {
},
]);
expect(mockStore.addComment).toHaveBeenCalled();
expect(mockStore.addSteeringComment).toHaveBeenCalled();
});
it("creates steering comment for inline code suggestions", async () => {
@@ -109,7 +109,7 @@ describe("PrCommentHandler", () => {
},
]);
expect(mockStore.addComment).toHaveBeenCalled();
expect(mockStore.addSteeringComment).toHaveBeenCalled();
});
});
@@ -126,7 +126,7 @@ describe("PrCommentHandler", () => {
},
]);
const call = (mockStore.addComment as ReturnType<typeof vi.fn>).mock.calls[0];
const call = (mockStore.addSteeringComment as ReturnType<typeof vi.fn>).mock.calls[0];
const text = call[1] as string;
expect(text).toContain("PR Review Feedback");
@@ -151,7 +151,7 @@ describe("PrCommentHandler", () => {
},
]);
const call = (mockStore.addComment as ReturnType<typeof vi.fn>).mock.calls[0];
const call = (mockStore.addSteeringComment as ReturnType<typeof vi.fn>).mock.calls[0];
const text = call[1] as string;
expect(text.length).toBeLessThan(longBody.length);
@@ -170,7 +170,7 @@ describe("PrCommentHandler", () => {
},
]);
expect(mockStore.addComment).toHaveBeenCalledWith(
expect(mockStore.addSteeringComment).toHaveBeenCalledWith(
"FN-001",
expect.any(String),
"agent"
@@ -189,7 +189,7 @@ describe("PrCommentHandler", () => {
},
]);
const text = (mockStore.addComment as ReturnType<typeof vi.fn>).mock.calls[0][1] as string;
const text = (mockStore.addSteeringComment as ReturnType<typeof vi.fn>).mock.calls[0][1] as string;
expect(text).toContain("This PR is already merged");
expect(text).toContain("follow-up work");
});