vitest.config.ts 780 B

123456789101112131415161718192021
  1. import { defineConfig } from 'vitest/config'
  2. import { resolve } from 'path'
  3. export default defineConfig({
  4. test: {
  5. environment: 'jsdom',
  6. globals: true,
  7. setupFiles: ['./src/__tests__/setup.ts'],
  8. // Playwright owns e2e/. Without this, vitest's default glob picks up the
  9. // .spec.ts files there and fails on an import it cannot resolve.
  10. // The database-backed tests have their own config (vitest.db.config.ts).
  11. exclude: ['e2e/**', 'src/__tests__/db/**', '**/node_modules/**', '**/dist/**', '**/.next/**'],
  12. },
  13. resolve: {
  14. alias: {
  15. '@': resolve(__dirname, './src'),
  16. // Lets server-only modules be imported directly by a test; see the stub.
  17. 'server-only': resolve(__dirname, './src/__tests__/stubs/server-only.ts'),
  18. },
  19. },
  20. })