import { defineConfig } from 'vitest/config';
import { resolve } from 'node:path';

export default defineConfig({
  test: {
    globals: true,
    watch: false,
    environment: 'node',
    setupFiles: ['reflect-metadata'],
    include: ['apps/api/src/**/*.{test,spec}.ts'],
    exclude: ['node_modules/**', 'apps/api/dist/**', 'dist/**'],
    coverage: {
      enabled: false,
      provider: 'v8',
      reportsDirectory: 'coverage/api',
      reporter: ['text', 'html', 'lcov'],
      // "Logic only" coverage scope: service layer only.
      // (Presenters have wide surface area; once all presenter suites exist, we can add them back.)
      include: ['apps/api/src/domain/**/*Service.ts'],
      exclude: [
        '**/*.test.ts',
        '**/*.spec.ts',
        '**/*.d.ts',
        'apps/api/dist/**',
        'dist/**',
        'node_modules/**',
      ],
      thresholds: {
        lines: 95,
        branches: 90,
        functions: 95,
        statements: 95,
      },
    },
  },
  resolve: {
    alias: {
      '@core': resolve(__dirname, './core'),
      '@adapters': resolve(__dirname, './adapters'),
      '@testing': resolve(__dirname, './testing'),
    },
  },
});