import { defineConfig } from 'vitest/config' import react from '@vitejs/plugin-react' import path from 'path' export default defineConfig({ plugins: [react()], test: { globals: true, environment: 'jsdom', setupFiles: ['./tests/setup.ts'], include: ['src/**/*.{test,spec}.{ts,tsx}', 'tests/**/*.{test,spec}.{ts,tsx}'], exclude: ['node_modules', 'dist', 'e2e'], coverage: { provider: 'v8', reporter: ['text', 'json', 'html'], exclude: [ 'node_modules/', 'tests/', '**/*.d.ts', '**/*.config.*', '**/types/**', ], thresholds: { // 前端覆盖率目标 >= 70% lines: 70, branches: 70, functions: 70, statements: 70, }, }, // 测试超时设置 testTimeout: 10000, hookTimeout: 10000, }, resolve: { alias: { '@': path.resolve(__dirname, './src'), }, }, })