import { defineConfig } from 'vitest/config';

export default defineConfig({
  test: {
    globals: true,
    environment: 'node',
    setupFiles: ['./src/test-setup.ts'],
    // E2E suite is run by vitest.config.e2e.ts via npm run test:e2e:* —
    // exclude from the default unit-test run so `npm test` stays fast and
    // doesn't require Docker / Bridge.
    // `.claude/**` is a Claude Code internal artifact (agent worktrees,
    // session state) and never contains project tests — excluding so
    // background agents don't pollute local test runs.
    exclude: ['test/e2e/**', 'node_modules/**', 'dist/**', '.claude/**'],
    coverage: {
      provider: 'v8',
      reporter: ['text', 'json', 'html'],
      exclude: [
        'node_modules/**',
        'dist/**',
        '**/*.d.ts',
        '**/*.config.*',
        '**/test/**',
      ],
      // Minimum coverage thresholds — CI will fail if these are not met.
      // Set conservatively below current measured levels; raise as coverage improves.
      // Measured after notification-channels additions: 94.67 / 90.98 / 93.99 / 96.07.
      // Branches + functions dip with each new service whose uncovered
      // portion is pure subprocess plumbing (default runners for osascript /
      // notify-send / powershell). Worth covering in a later pass with
      // end-to-end subprocess tests; low-priority for correctness now.
      thresholds: {
        statements: 94,
        branches: 90,
        functions: 93,
        lines: 96,
      },
    },
  },
});
