import { defineConfig } from 'vitest/config'
import react from '@vitejs/plugin-react'
import tsconfigPaths from 'vite-tsconfig-paths'

export default defineConfig({
  plugins: [tsconfigPaths(), react()],
  test: {
    environment: 'jsdom',
    setupFiles: ['./vitest.setup.ts'],
    include: [
      'tests/int/**/*.int.spec.ts',
      'tests/unit/**/*.unit.spec.ts',
    ],
    coverage: {
      provider: 'v8',
      reporter: ['text', 'text-summary', 'html', 'lcov'],
      reportsDirectory: './coverage',
      include: [
        'src/lib/**/*.ts',
        'src/hooks/**/*.ts',
        'src/app/**/api/**/route.ts',
      ],
      exclude: [
        'src/**/*.d.ts',
        'src/**/payload-types.ts',
        'node_modules/**',
      ],
      // Initial thresholds - increase as test coverage improves
      thresholds: {
        lines: 35,
        functions: 50,
        branches: 65,
        statements: 35,
      },
    },
  },
})
