import { defineConfig } from "vitest/config"; import react from "@vitejs/plugin-react"; export default defineConfig({ plugins: [react()], // Native tsconfig path resolution (replaces vite-tsconfig-paths in Vite 5+/Vitest 2+). resolve: { tsconfigPaths: true, }, test: { // jsdom covers the few client-helper modules we test (auth-provider, csv export, etc.) // Server-side unit tests don't depend on the DOM. environment: "jsdom", globals: false, include: [ "src/**/*.{test,spec}.{ts,tsx}", // One-shot scripts under `scripts/` ship their own *.test.ts // (e.g. scripts/backfill-stock-prices.test.ts for the pure // decision logic). Pulled in here so `vitest run scripts/` // picks them up without a per-script config file. "scripts/**/*.test.ts", ], // Exclude Playwright E2E specs from Vitest. exclude: [ "node_modules/**", ".next/**", "e2e/**", "playwright-report/**", "test-results/**", ], setupFiles: ["./src/test-setup.ts"], }, });