/** * Vitest Configuration - 测试框架配置 */ import { defineConfig } from 'vitest/config' import react from '@vitejs/plugin-react' import path from 'path' export default defineConfig({ plugins: [ react(), { name: 'electron-test', // Mock Electron APIs for renderer tests } ], test: { globals: true, environment: 'jsdom', setupFiles: ['./test/setup.ts'], include: ['test/**/*.{test,spec}.{ts,tsx}'], coverage: { provider: 'v8', reporter: ['text', 'json', 'html'], exclude: [ 'node_modules/', 'dist/', 'dist-electron/', 'test/setup.ts', '**/*.d.ts', 'electron/**' ], thresholds: { global: { branches: 50, functions: 50, lines: 50, statements: 50 } } } }, resolve: { alias: { '@': path.resolve(__dirname, './src'), '@shared': path.resolve(__dirname, './shared') } } })