import path from "node:path";
import { mergeConfig } from "vitest/config";
import { nodeVitestConfig } from "@repo/core-typescript/vitest.base.node";
import {
  DEFAULT_COVERAGE_BANDS,
  vitestThresholdsFromBands,
} from "@repo/core-shared/conformance/coverage";

// Coverage thresholds derived from DEFAULT_COVERAGE_BANDS via the shared
// helper (ADR-020). The feature.manifest.ts `coverage.bands` section
// declares these for boot-time `assertFeatureConformance`. Edit the
// manifest, not this file, when adjusting per-feature bands.
export default mergeConfig(nodeVitestConfig, {
  test: {
    coverage: {
      exclude: [
        // DI bootstrap — wires InversifyJS at app startup; not unit-testable
        "src/di/bind-production.ts",
        // Pure TypeScript interface files — not executable
        "src/application/repositories/**",
        // Payload CMS collection config — declarative data, tested via Payload integration
        "src/integrations/cms/**",
        // React Query option builders — integration-tested in apps
        "src/ui/**",
      ],
      thresholds: vitestThresholdsFromBands(DEFAULT_COVERAGE_BANDS),
    },
  },
  resolve: {
    alias: { "@": path.resolve(__dirname, "./src") },
  },
});
