Ctrl K
ComunidadGuías…

vitest.config.js

Rama master · réplica de lectura del repositorio original.

Archivo original ↗Preguntar a KiBot
import { defineConfig } from "vitest/config";
import { availableParallelism } from "node:os";

const configuredWorkers = process.env.AI_GATEWAY_TEST_MAX_WORKERS;
if (configuredWorkers !== undefined && !/^[1-8]$/.test(configuredWorkers)) {
  throw new Error("AI_GATEWAY_TEST_MAX_WORKERS must be an integer from 1 to 8.");
}
const maxWorkers = configuredWorkers === undefined
  ? Math.max(2, Math.min(8, availableParallelism()))
  : Number(configuredWorkers);

export default defineConfig({
  test: {
    include: [
      // Match pnpm's direct workspace roots, not source copies in evidence.
      "packages/*/src/**/*.test.{js,mjs,ts,mts}",
      "apps/*/src/**/*.test.{js,mjs,ts,mts}",
    ],
    testTimeout: 15000,
    hookTimeout: 10000,
    maxWorkers,
    coverage: {
      provider: "v8",
      // json-summary is what check-coverage-thresholds.mjs reads; the merge run
      // in tools/run-tests-with-coverage.mjs is the only run that writes it.
      // Thresholds deliberately live in that tool, not here: each collecting
      // group run would otherwise fail mid-suite before the merge exists.
      reporter: ["text", "text-summary", "json-summary", "lcov", "html"],
      reportsDirectory: "coverage",
      include: [
        "apps/*/src/**/*.{js,mjs,ts,mts}",
        "packages/*/src/**/*.{js,mjs,ts,mts}",
      ],
      exclude: [
        "**/node_modules/**",
        "**/evidence/**",
        "**/*.test.*",
        "**/*.d.ts",
        "**/fixtures/**",
        "**/*.config.*",
        "apps/*/src/entrypoints/**",
      ],
    },
  },
});