Files
knowai/vitest.config.ts
tobegold574 0969e00d76 feat(DOC): 完整地审查了代码,更完整的注释说明
- 未修改代码
- 统一了所有组件README的格式
2025-11-23 22:29:31 +08:00

45 lines
1.3 KiB
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { defineConfig } from 'vitest/config';
import vue from '@vitejs/plugin-vue';
import { fileURLToPath, URL } from 'node:url';
export default defineConfig({
plugins: [vue()],
resolve: {
// import.meta是ESM运行时元信息import.meta.url时当前目录路径
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url)),
'~': fileURLToPath(new URL('./src', import.meta.url))
},
},
test: {
// 这里都没用啊因为组合环境的问题vitest会出现IPC通信报错暂时无法解决
timeout: 60000, // 60秒超时
globals: true,
environment: 'jsdom', // Vue组件测试需要浏览器环境
threads: false, // 禁用多线程以解决线程相关报错
coverage: {
provider: 'v8',
reporter: ['text', 'json', 'html'],
exclude: [
'node_modules/',
'dist/',
'**/*.config.js',
'**/*.config.ts',
'**/*.d.ts',
'**/index.ts',
'**/*.test.ts',
'**/*.spec.ts',
],
thresholds: {
global: {
branches: 80,
functions: 80,
lines: 80,
statements: 80,
},
},
},
setupFiles: ['./test/setup.ts'], // 全局测试设置
include: ['src/**/*.test.ts', 'src/**/*.spec.ts']
},
});