import { defineConfig } from 'vitest/config'; import react from '@vitejs/plugin-react'; export default defineConfig({ plugins: [react()], test: { globals: true, // Default environment is node so the existing domain tests under src/ keep // running exactly as before. Web/UI tests are switched to jsdom per-glob. environment: 'node', environmentMatchGlobs: [ ['web/**', 'jsdom'], ['**/*.tsx', 'jsdom'], ], include: [ 'src/**/*.{test,spec}.ts', 'web/**/*.{test,spec}.{ts,tsx}', ], // Both setup files are registered globally. The src setup only configures // fast-check; the web setup additionally registers DOM/axe matchers and RTL // cleanup — harmless to load in node since the matchers are only invoked by // jsdom tests. setupFiles: ['src/__tests__/setup.ts', 'web/src/__tests__/setup.ts'], coverage: { provider: 'v8', reportsDirectory: './coverage', include: ['src/**/*.ts', 'web/src/**/*.{ts,tsx}'], exclude: [ 'src/**/*.{test,spec}.ts', 'src/**/__tests__/**', 'web/**/*.{test,spec}.{ts,tsx}', 'web/**/__tests__/**', ], }, }, });