fix(test): add mock-driver tests for database services
- Add connected-path tests for mysql, sql-server, and postgresql using mocked drivers (mysql2/promise, mssql, pg) covering connect, query, transaction, and disconnect scenarios - Fix tautological assertion in auth-flow.test.ts (hasError >= 0 was always true) - Add tests/integration to vitest exclude list to prevent module cache pollution under isolate:false - Set isolate to true for CI, false for local dev (was: isolate false)
This commit is contained in:
@@ -6,13 +6,13 @@ export default defineConfig({
|
||||
globals: true,
|
||||
environment: 'node',
|
||||
include: ['tests/**/*.{test,spec}.{ts,tsx}'],
|
||||
exclude: ['node_modules', 'dist', 'out', 'tests/e2e'],
|
||||
exclude: ['node_modules', 'dist', 'out', 'tests/e2e', 'tests/integration'],
|
||||
setupFiles: ['tests/setup.ts'],
|
||||
env: {
|
||||
NODE_ENV: 'test'
|
||||
},
|
||||
// 性能优化配置
|
||||
isolate: false, // 禁用隔离(提升 30-50% 速度)
|
||||
// CI 环境启用隔离以捕获跨文件状态污染;本地开发禁用以提升速度
|
||||
isolate: !!process.env.CI,
|
||||
pool: 'threads', // 使用线程池
|
||||
maxWorkers: 4,
|
||||
bail: process.env.CI ? 1 : undefined,
|
||||
|
||||
Reference in New Issue
Block a user