import { defineConfig } from 'vitest/config'; export default defineConfig({ test: { globals: true, environment: 'node', include: ['tests/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'], coverage: { provider: 'v8', reporter: ['text', 'json', 'html'], exclude: [ 'tests/**', '**/*.d.ts', '**/*.config.*', '**/dist/**' ] }, // 关闭并行测试以避免数据库连接冲突 fileParallelism: false, // 设置测试环境变量 setupFiles: [], env: { NODE_ENV: 'test', TEST_DATABASE_URL: 'postgresql://postgres:test_password@localhost:5432/test_d8dai' } } });