import path from "node:path";
import { mergeConfig } from "vitest/config";
import { nodeVitestConfig } from "@repo/core-typescript/vitest.base.node";

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 templates — declarative data, tested via integration
        "src/integrations/cms/**",
        // React Query option builders — integration-tested in apps
        "src/ui/**",
      ],
      thresholds: {
        "src/entities/**": {
          statements: 100,
          branches: 100,
          functions: 100,
          lines: 100,
        },
        "src/application/use-cases/**": {
          statements: 100,
          branches: 95,
          functions: 100,
          lines: 100,
        },
        "src/interface-adapters/controllers/**": {
          statements: 100,
          branches: 95,
          functions: 100,
          lines: 100,
        },
        statements: 80,
        branches: 75,
        functions: 80,
        lines: 80,
      },
    },
  },
  resolve: {
    alias: { "@": path.resolve(__dirname, "./src") },
  },
});
