22 lines
1.0 KiB
TypeScript
22 lines
1.0 KiB
TypeScript
import { fileURLToPath, URL } from 'node:url'
|
|
import { configDefaults, defineConfig } from 'vitest/config'
|
|
import vue from '@vitejs/plugin-vue'
|
|
|
|
/** 使用轻量 DOM 测试 API、异步状态和 Vue 页面行为。 */
|
|
export default defineConfig({
|
|
plugins: [vue()],
|
|
resolve: { alias: { '@': fileURLToPath(new URL('./src', import.meta.url)) } },
|
|
test: {
|
|
environment: 'happy-dom',
|
|
/** 全量测试统一检测警告,并阻止遗漏模拟的请求连接真实服务。 */
|
|
setupFiles: ['./tests/setup.ts'],
|
|
restoreMocks: true,
|
|
/** 限制同时挂载的页面测试数量,避免 Naive UI 渲染争抢资源造成超时。 */
|
|
maxWorkers: 2,
|
|
/** 只收集正式测试目录,避免把包管理缓存中的旧项目快照作为当前测试。 */
|
|
include: ['tests/**/*.test.ts'],
|
|
/** 只检查当前 checkout,避免收集其它隔离 worktree 中的重复测试。 */
|
|
exclude: [...configDefaults.exclude, '**/.worktrees/**', '**/.worktree/**']
|
|
}
|
|
})
|