import { defineConfig } from 'vitest/config';

export default defineConfig({
  test: {
    globals: true,
    environment: 'node',
    passWithNoTests: true,
    coverage: {
      provider: 'v8',
      reporter: ['text', 'text-summary'],
      // Only the modules we've explicitly committed to keeping covered are
      // subject to the threshold; the rest of the codebase is reported but
      // not gated. Add files here as they gain a real test suite (ratchet,
      // do not relax).
      include: [
        'src/lib/auth.ts',
        'src/lib/csrf.ts',
        'src/lib/shell.ts',
        'src/modules/health/repository.ts',
        'src/modules/hermes-ops/repository.ts',
        'src/modules/hermes-telemetry/repository.ts',
        'src/modules/deployments/orchestrator.ts',
        'src/modules/services/repository.ts',
      ],
      thresholds: {
        // Module-wide minimums — actual numbers today are well above these
        // (≥95% lines for every gated file). Floor is set conservatively so
        // routine refactors don't trip the gate.
        lines: 85,
        functions: 85,
        statements: 85,
        branches: 65,
      },
    },
  },
});
