ci: disable automatic workflow triggers
This commit is contained in:
@@ -83,8 +83,12 @@ describe("Version & Release workflow (.github/workflows/version.yml)", () => {
|
||||
expect(typeof workflow).toBe("object");
|
||||
});
|
||||
|
||||
it("has push trigger on main", () => {
|
||||
expect(workflow.on.push.branches).toContain("main");
|
||||
it("uses workflow_dispatch trigger (auto release disabled)", () => {
|
||||
expect(workflow.on).toHaveProperty("workflow_dispatch");
|
||||
});
|
||||
|
||||
it("does not auto-trigger on push", () => {
|
||||
expect(workflow.on.push).toBeUndefined();
|
||||
});
|
||||
|
||||
it("includes pnpm install step", () => {
|
||||
@@ -143,9 +147,12 @@ describe("Binary release workflow (.github/workflows/release.yml)", () => {
|
||||
expect(typeof workflow).toBe("object");
|
||||
});
|
||||
|
||||
it("triggers on version tags", () => {
|
||||
expect(workflow.on.push.tags).toBeDefined();
|
||||
expect(workflow.on.push.tags.some((t: string) => t.includes("v"))).toBe(true);
|
||||
it("uses workflow_dispatch trigger (auto binary release disabled)", () => {
|
||||
expect(workflow.on).toHaveProperty("workflow_dispatch");
|
||||
});
|
||||
|
||||
it("does not auto-trigger on version tags", () => {
|
||||
expect(workflow.on.push).toBeUndefined();
|
||||
});
|
||||
|
||||
it("has build-binaries job with 4-target matrix", () => {
|
||||
|
||||
@@ -40,7 +40,7 @@ describe("Changeset configuration", () => {
|
||||
|
||||
const content = readFileSync(workflowPath, "utf-8");
|
||||
expect(content).toContain("changesets/action");
|
||||
expect(content).toContain("push");
|
||||
expect(content).toContain("main");
|
||||
expect(content).toContain("workflow_dispatch");
|
||||
expect(content).toContain("Auto-trigger disabled");
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { describe, it, expect, vi, beforeEach } from "vitest";
|
||||
import { describe, it, expect, vi, beforeEach, afterEach } from "vitest";
|
||||
import { EventEmitter } from "node:events";
|
||||
|
||||
// ── Capture arguments ───────────────────────────────────────────────
|
||||
@@ -6,6 +6,10 @@ import { EventEmitter } from "node:events";
|
||||
// Minimal mock store backed by EventEmitter so `store.on` works
|
||||
function makeMockStore() {
|
||||
const emitter = new EventEmitter();
|
||||
// runDashboard registers several independent settings listeners by design;
|
||||
// keep the test mock above Node's low default threshold while still checking
|
||||
// startup wiring behavior.
|
||||
emitter.setMaxListeners(20);
|
||||
const mockMissionStore = {
|
||||
listMissions: vi.fn().mockReturnValue([]),
|
||||
getMission: vi.fn(),
|
||||
@@ -214,10 +218,28 @@ vi.mock("@mariozechner/pi-coding-agent", () => ({
|
||||
|
||||
// ── Import module under test (after mocks) ──────────────────────────
|
||||
|
||||
const { runDashboard } = await import("../dashboard.js");
|
||||
const { runDashboard: runDashboardImpl } = await import("../dashboard.js");
|
||||
const dashboardDisposables: Array<() => void> = [];
|
||||
|
||||
function disposeTrackedDashboards(): void {
|
||||
for (const dispose of dashboardDisposables.splice(0)) {
|
||||
dispose();
|
||||
}
|
||||
}
|
||||
|
||||
async function runDashboard(...args: Parameters<typeof runDashboardImpl>): ReturnType<typeof runDashboardImpl> {
|
||||
disposeTrackedDashboards();
|
||||
const result = await runDashboardImpl(...args);
|
||||
dashboardDisposables.push(result.dispose);
|
||||
return result;
|
||||
}
|
||||
|
||||
// ── Tests ───────────────────────────────────────────────────────────
|
||||
|
||||
afterEach(() => {
|
||||
disposeTrackedDashboards();
|
||||
});
|
||||
|
||||
describe("runDashboard — AuthStorage & ModelRegistry wiring", () => {
|
||||
beforeEach(async () => {
|
||||
vi.clearAllMocks();
|
||||
|
||||
@@ -35,6 +35,10 @@ const {
|
||||
// Minimal mock store backed by EventEmitter so `store.on` works
|
||||
function makeMockStore() {
|
||||
const emitter = new EventEmitter();
|
||||
// runDashboard registers several independent settings listeners by design;
|
||||
// keep the test mock above Node's low default threshold while still asserting
|
||||
// disposal behavior in the lifecycle cleanup tests below.
|
||||
emitter.setMaxListeners(20);
|
||||
const mockMissionStore = {
|
||||
listMissions: vi.fn().mockReturnValue([]),
|
||||
getMission: vi.fn(),
|
||||
@@ -164,12 +168,19 @@ const {
|
||||
mockMergePr,
|
||||
} = vi.hoisted(() => ({
|
||||
mockExec: vi.fn((_command: string, _options?: any, callback?: (err: null, stdout: string, stderr: string) => void) => {
|
||||
// Handle both callback-style (original exec) and promise-style (promisified execAsync)
|
||||
if (typeof callback === "function") {
|
||||
callback(null, "", "");
|
||||
}
|
||||
// Return resolved promise for promisified usage
|
||||
return Promise.resolve({ stdout: "", stderr: "" });
|
||||
// Match child_process.exec's callback-style contract. Returning a Promise
|
||||
// makes util.promisify(exec) emit DEP0174 in tests.
|
||||
return {
|
||||
pid: 12345,
|
||||
stdout: null,
|
||||
stderr: null,
|
||||
on: vi.fn(),
|
||||
once: vi.fn(),
|
||||
kill: vi.fn(),
|
||||
};
|
||||
}),
|
||||
mockExecSync: vi.fn(() => ""),
|
||||
mockFindPrForBranch: vi.fn(),
|
||||
@@ -329,8 +340,22 @@ vi.mock("@mariozechner/pi-coding-agent", () => ({
|
||||
|
||||
// ── Import module under test (after mocks) ──────────────────────────
|
||||
|
||||
const { runDashboard } = await import("./dashboard.js");
|
||||
const { runDashboard: runDashboardImpl } = await import("./dashboard.js");
|
||||
const { processPullRequestMergeTask, getMergeStrategy, getTaskBranchName } = await import("./task-lifecycle.js");
|
||||
const dashboardDisposables: Array<() => void> = [];
|
||||
|
||||
function disposeTrackedDashboards(): void {
|
||||
for (const dispose of dashboardDisposables.splice(0)) {
|
||||
dispose();
|
||||
}
|
||||
}
|
||||
|
||||
async function runDashboard(...args: Parameters<typeof runDashboardImpl>): ReturnType<typeof runDashboardImpl> {
|
||||
disposeTrackedDashboards();
|
||||
const result = await runDashboardImpl(...args);
|
||||
dashboardDisposables.push(result.dispose);
|
||||
return result;
|
||||
}
|
||||
|
||||
// ── Tests ───────────────────────────────────────────────────────────
|
||||
|
||||
@@ -385,6 +410,10 @@ beforeEach(() => {
|
||||
mockStuckCheckNow.mockResolvedValue(undefined);
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
disposeTrackedDashboards();
|
||||
});
|
||||
|
||||
describe("PR merge helpers", () => {
|
||||
it("defaults mergeStrategy to direct when unset", () => {
|
||||
expect(getMergeStrategy({ mergeStrategy: undefined })).toBe("direct");
|
||||
|
||||
Reference in New Issue
Block a user