diff --git a/tests/process-global/vitestConfiguration.test.ts b/tests/process-global/vitestConfiguration.test.ts index c676078609..f163adfe15 100644 --- a/tests/process-global/vitestConfiguration.test.ts +++ b/tests/process-global/vitestConfiguration.test.ts @@ -6,10 +6,7 @@ import { promisify } from "node:util"; import { describe, expect, it } from "vitest"; -import vitestConfiguration, { - MAX_TEST_WORKERS, - TEST_PROJECTS, -} from "../../vitest.config.js"; +import vitestConfiguration from "../../vitest.config.js"; const execute = promisify(execFile); const EXPECTED_PROJECTS = [ @@ -30,29 +27,28 @@ describe("Vitest project configuration", () => { expect(vitestConfiguration.test?.reporters).toEqual(["default"]); expect(vitestConfiguration.test?.retry).toBe(0); const local = process.env.CI !== "true"; - expect(MAX_TEST_WORKERS).toBe( - local ? 1 : Math.min(2, availableParallelism()), + const maxWorkers = local ? 1 : Math.min(2, availableParallelism()); + expect(vitestConfiguration.test?.maxWorkers).toBe(maxWorkers); + const projects = (vitestConfiguration.test?.projects ?? []).flatMap( + (project) => + typeof project === "object" && project !== null && "test" in project + ? [project.test] + : [], ); + expect(projects).toHaveLength(EXPECTED_PROJECTS.length); expect( - TEST_PROJECTS.every( + projects.every( ({ fileParallelism, maxWorkers, sequence }) => - maxWorkers === MAX_TEST_WORKERS && + maxWorkers === vitestConfiguration.test?.maxWorkers && (local ? fileParallelism === false && sequence?.groupOrder !== undefined : true), ), ).toBe(true); - expect(TEST_PROJECTS.map(({ name }) => name).sort()).toEqual( - EXPECTED_PROJECTS, - ); - const sharedModuleProjects = new Set([ - "domain", - "mcp-boundary", - "services", - ]); + expect(projects.map(({ name }) => name).sort()).toEqual(EXPECTED_PROJECTS); expect( - TEST_PROJECTS.every(({ name, isolate }) => - sharedModuleProjects.has(name) + projects.every(({ name, isolate }) => + name === "domain" || name === "mcp-boundary" || name === "services" ? isolate === false : isolate === undefined, ), diff --git a/vitest.config.ts b/vitest.config.ts index 9d21db260a..7f979325ec 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -15,11 +15,9 @@ const LOCAL_ONLY = process.env.CI !== "true"; // Keep local runs to one worker and one project at a time. CI shards have // dedicated capacity and retain the existing bounded worker budget. -export const MAX_TEST_WORKERS = LOCAL_ONLY - ? 1 - : Math.min(2, availableParallelism()); +const MAX_TEST_WORKERS = LOCAL_ONLY ? 1 : Math.min(2, availableParallelism()); -export const TEST_PROJECTS = [ +const TEST_PROJECTS = [ { name: "domain", include: ["src/{contracts,domain}/**/*.test.ts"],