import { defineConfig } from 'vitest/config'
import react from '@vitejs/plugin-react'
import path from 'node:path'

// Vitest config for the `fast` profile (per AZ-456 / _docs/02_document/tests/environment.md).
// jsdom + RTL + MSW. Decoupled from vite.config.ts on purpose — the dev/prod bundle
// pulls in tailwindcss + dev-server proxy that tests have no use for.
export default defineConfig({
  plugins: [react()],
  resolve: {
    alias: {
      '@': path.resolve(__dirname, './src'),
    },
  },
  test: {
    environment: 'jsdom',
    setupFiles: ['./tests/setup.ts'],
    globals: true,
    css: false,
    include: [
      'tests/**/*.test.{ts,tsx}',
      'src/**/*.test.{ts,tsx}',
      'mission-planner/src/**/*.test.{ts,tsx}',
    ],
    exclude: [
      'e2e/**',
      'node_modules/**',
      'dist/**',
      'test-output/**',
    ],
    reporters: [
      'default',
      ['junit', { outputFile: './test-output/fast-report.xml' }],
    ],
    coverage: {
      provider: 'v8',
      reporter: ['text', 'json-summary'],
      reportsDirectory: './test-output/coverage',
      include: ['src/**/*.{ts,tsx}'],
      exclude: [
        'src/**/*.test.{ts,tsx}',
        'src/types/**',
        'src/vite-env.d.ts',
        'src/main.tsx',
      ],
    },
  },
})
