import { defineConfig } from 'vitest/config';

export default defineConfig({
  test: {
    globals: true,
    environment: 'node',
    setupFiles: ['./tests/setup.ts'],
    // Skip legacy tests that need migration from SQLite to Prisma
    // These tests were written for the old SQLite-based implementation
    // and need to be updated to work with async Prisma methods
    exclude: [
      '**/node_modules/**',
      '**/dist/**',
      // Legacy tests that use synchronous SQLite patterns
      // These tests need to be migrated to async Prisma patterns
      'tests/sync.routes.spec.ts',
      'tests/auth-flows.spec.ts',
      'tests/registration-api.spec.ts',
      'tests/api.routes.spec.ts',
      // Tests internal impl details that no longer match current service
      'tests/snapshot-skip-optimization.spec.ts',
      'tests/integration/multi-client-sync.integration.spec.ts',
      'tests/integration/snapshot-skip-optimization.integration.spec.ts',
      // Integration test that requires real PostgreSQL (run with vitest.integration.config.ts)
      'tests/integration/snapshot-vector-clock-sql.integration.spec.ts',
      'tests/integration/conflict-detection-sql.integration.spec.ts',
      // Tests password reset routes that don't exist - server uses passkey/magic link auth
      'tests/password-reset-api.spec.ts',
    ],
  },
});
