import { defineVitestConfig } from '@nuxt/test-utils/config'

export default defineVitestConfig({
  test: {
    exclude: ['**/node_modules/**', 'test/e2e/**', 'test/integration/**'],
    environment: 'nuxt',
    environmentOptions: {
      nuxt: {
        domEnvironment: 'happy-dom',
      },
    },
    coverage: {
      provider: 'v8',
      reporter: ['text', 'html'],
      include: ['app/**/*.js', 'app/**/*.vue', 'server/utils/**/*.js'],
      exclude: [
        'app/app.vue',
        'app/pages/**/*.vue',
        'app/components/**/*.vue', // UI components; covered by E2E / manual
        'app/error.vue', // Error page; covered by E2E
        'app/composables/useWebRTC.js', // Browser/WebRTC glue; covered by E2E
        'app/composables/useLiveSessions.js', // Visibility/polling branches; covered by E2E
        'app/composables/useCameras.js', // Visibility/polling branches; covered by E2E
        'app/composables/**/*.js', // Composables (polling, visibility, user); covered by E2E / integration
        'server/utils/mediasoup.js', // Requires real mediasoup worker; covered by integration/E2E
        'server/utils/db.js', // Bootstrap/path branches depend on env; covered by integration
        '**/*.spec.js',
        '**/*.config.js',
        '**/node_modules/**',
        'test/e2e/**', // Exclude E2E tests from unit test coverage
      ],
      thresholds: {
        lines: 85,
        functions: 85,
        branches: 85,
        statements: 85,
      },
    },
  },
})
