Files
files-hash/vitest.config.js

58 lines
1.3 KiB
JavaScript

import { defineConfig } from 'vitest/config';
export default defineConfig({
test: {
// 测试环境
environment: 'node',
// 测试文件匹配模式
include: ['**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
// 排除的文件
exclude: ['node_modules', 'dist', '.git', '.github'],
// 全局设置
globals: false,
// 测试超时时间(毫秒)
testTimeout: 10000,
// 钩子超时时间(毫秒)
hookTimeout: 10000,
// 并发运行测试
pool: 'threads',
// 覆盖率配置
coverage: {
provider: 'v8',
reporter: ['text', 'json', 'html'],
exclude: [
'coverage/**',
'dist/**',
'packages/*/test{,s}/**',
'**/*.d.ts',
'cypress/**',
'test{,s}/**',
'test{,-*}.{js,cjs,mjs,ts,tsx,jsx}',
'**/*{.,-}test.{js,cjs,mjs,ts,tsx,jsx}',
'**/*{.,-}spec.{js,cjs,mjs,ts,tsx,jsx}',
'**/__tests__/**',
'**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build}.config.*',
'**/.{eslint,mocha,prettier}rc.{js,cjs,yml}',
'run-tests.js',
'examples/**',
],
},
// 报告器
reporter: ['verbose'],
// 在测试失败时停止
bail: 0,
// 重试次数
retry: 0,
},
});