test: remove Vitest config test exports
This commit is contained in:
@@ -6,10 +6,7 @@ import { promisify } from "node:util";
|
|||||||
|
|
||||||
import { describe, expect, it } from "vitest";
|
import { describe, expect, it } from "vitest";
|
||||||
|
|
||||||
import vitestConfiguration, {
|
import vitestConfiguration from "../../vitest.config.js";
|
||||||
MAX_TEST_WORKERS,
|
|
||||||
TEST_PROJECTS,
|
|
||||||
} from "../../vitest.config.js";
|
|
||||||
|
|
||||||
const execute = promisify(execFile);
|
const execute = promisify(execFile);
|
||||||
const EXPECTED_PROJECTS = [
|
const EXPECTED_PROJECTS = [
|
||||||
@@ -30,29 +27,28 @@ describe("Vitest project configuration", () => {
|
|||||||
expect(vitestConfiguration.test?.reporters).toEqual(["default"]);
|
expect(vitestConfiguration.test?.reporters).toEqual(["default"]);
|
||||||
expect(vitestConfiguration.test?.retry).toBe(0);
|
expect(vitestConfiguration.test?.retry).toBe(0);
|
||||||
const local = process.env.CI !== "true";
|
const local = process.env.CI !== "true";
|
||||||
expect(MAX_TEST_WORKERS).toBe(
|
const maxWorkers = local ? 1 : Math.min(2, availableParallelism());
|
||||||
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(
|
expect(
|
||||||
TEST_PROJECTS.every(
|
projects.every(
|
||||||
({ fileParallelism, maxWorkers, sequence }) =>
|
({ fileParallelism, maxWorkers, sequence }) =>
|
||||||
maxWorkers === MAX_TEST_WORKERS &&
|
maxWorkers === vitestConfiguration.test?.maxWorkers &&
|
||||||
(local
|
(local
|
||||||
? fileParallelism === false && sequence?.groupOrder !== undefined
|
? fileParallelism === false && sequence?.groupOrder !== undefined
|
||||||
: true),
|
: true),
|
||||||
),
|
),
|
||||||
).toBe(true);
|
).toBe(true);
|
||||||
expect(TEST_PROJECTS.map(({ name }) => name).sort()).toEqual(
|
expect(projects.map(({ name }) => name).sort()).toEqual(EXPECTED_PROJECTS);
|
||||||
EXPECTED_PROJECTS,
|
|
||||||
);
|
|
||||||
const sharedModuleProjects = new Set([
|
|
||||||
"domain",
|
|
||||||
"mcp-boundary",
|
|
||||||
"services",
|
|
||||||
]);
|
|
||||||
expect(
|
expect(
|
||||||
TEST_PROJECTS.every(({ name, isolate }) =>
|
projects.every(({ name, isolate }) =>
|
||||||
sharedModuleProjects.has(name)
|
name === "domain" || name === "mcp-boundary" || name === "services"
|
||||||
? isolate === false
|
? isolate === false
|
||||||
: isolate === undefined,
|
: isolate === undefined,
|
||||||
),
|
),
|
||||||
|
|||||||
+2
-4
@@ -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
|
// Keep local runs to one worker and one project at a time. CI shards have
|
||||||
// dedicated capacity and retain the existing bounded worker budget.
|
// dedicated capacity and retain the existing bounded worker budget.
|
||||||
export const MAX_TEST_WORKERS = LOCAL_ONLY
|
const MAX_TEST_WORKERS = LOCAL_ONLY ? 1 : Math.min(2, availableParallelism());
|
||||||
? 1
|
|
||||||
: Math.min(2, availableParallelism());
|
|
||||||
|
|
||||||
export const TEST_PROJECTS = [
|
const TEST_PROJECTS = [
|
||||||
{
|
{
|
||||||
name: "domain",
|
name: "domain",
|
||||||
include: ["src/{contracts,domain}/**/*.test.ts"],
|
include: ["src/{contracts,domain}/**/*.test.ts"],
|
||||||
|
|||||||
Reference in New Issue
Block a user