import { defineConfig } from 'vitest/config'
import { resolve } from 'path'

export default defineConfig({
  test: {
    globals: true,
    environment: 'jsdom',
    setupFiles: ['./src/__tests__/setup.ts'],
    include: ['src/**/*.{test,spec}.{ts,tsx}'],
    exclude: [
      'src/__tests__/components/rendering/**',
      'src/__tests__/integration/*.render.test.tsx',
      'node_modules',
    ],
    coverage: {
      provider: 'v8',
      reporter: ['text', 'json', 'json-summary', 'html', 'lcov'],
      include: ['src/**/*.{ts,tsx}'],
      exclude: [
        'src/**/__tests__/**',
        'src/**/*.d.ts',
        'src/**/*.test.{ts,tsx}',
        'src/**/*.spec.{ts,tsx}',
        'src/**/index.ts',
        'src/**/types.ts',
        'src/**/CLAUDE.md',
        'src/shared/data/dataService.ts',
        'src/shared/data/useTranslatedData.ts',
        'src/shared/services/sync.ts',
        'src/shared/services/analytics.ts',
      ],
      thresholds: {
        'src/shared/stores/**': { lines: 85, branches: 65, functions: 90, statements: 85 },
        'src/shared/services/purchases.ts': { lines: 100 },
        'src/shared/services/sync.ts': { lines: 80 },
        'src/shared/services/analytics.ts': { lines: 80 },
        'src/shared/data/achievements.ts': { lines: 100 },
        'src/shared/data/programs.ts': { lines: 90 },
        'src/shared/data/trainers.ts': { lines: 100 },
        'src/shared/data/workouts.ts': { lines: 100 },
      },
    },
    testTimeout: 10000,
    hookTimeout: 10000,
  },
  resolve: {
    alias: {
      '@': resolve(__dirname, '.'),
    },
  },
})
