vitest.config.ts 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. import { defineConfig } from 'vitest/config';
  2. import react from '@vitejs/plugin-react';
  3. import path from 'path';
  4. export default defineConfig({
  5. plugins: [react()],
  6. test: {
  7. globals: true,
  8. environment: 'jsdom',
  9. environmentOptions: {
  10. jsdom: {
  11. url: 'http://localhost:3000',
  12. },
  13. },
  14. setupFiles: ['./src/__tests__/setup.ts'],
  15. testTimeout: 10000,
  16. // Console output only from failing tests (Docker, test_frontend.sh and
  17. // plain runs alike); pass --silent=false to see a passing test's logs.
  18. silent: 'passed-only',
  19. include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
  20. exclude: ['node_modules', 'dist'],
  21. coverage: {
  22. provider: 'v8',
  23. reporter: ['text', 'json', 'html'],
  24. include: ['src/**/*.{ts,tsx}'],
  25. exclude: [
  26. 'src/**/*.test.{ts,tsx}',
  27. 'src/**/*.spec.{ts,tsx}',
  28. 'src/__tests__/**',
  29. 'src/main.tsx',
  30. 'src/vite-env.d.ts',
  31. ],
  32. },
  33. },
  34. resolve: {
  35. alias: {
  36. '@': path.resolve(__dirname, './src'),
  37. },
  38. },
  39. });