-
Notifications
You must be signed in to change notification settings - Fork 95
Expand file tree
/
Copy pathvitest.config.mts
More file actions
37 lines (35 loc) · 1.08 KB
/
vitest.config.mts
File metadata and controls
37 lines (35 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import path from 'path';
import { defineConfig } from 'vitest/config';
import { InlineConfig } from 'vitest/node';
// 单元测试相关配置
const testConfig: InlineConfig = {
include:
process.env.NODE_ENV === 'test-snap'
? ['test/snap/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}']
: ['src/**/__tests__/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
globals: true,
environment: 'jsdom',
testTimeout: 16000,
testTransformMode: {
web: ['\\.[jt]sx$'],
},
coverage: {
enabled: true,
provider: 'istanbul',
exclude: ['src/**.{js,ts}', 'src/_common/**', 'src/_util/**', 'src/**/{__tests__,_example,style}/**'],
reporter: ['text', 'json', 'html'],
reportsDirectory: 'test/coverage',
include: ['src/**/*'],
},
setupFiles: [`./script/test/setup.js`],
};
export default defineConfig({
resolve: {
alias: {
'tdesign-mobile-react/es': path.resolve(__dirname, './src/'),
'tdesign-mobile-react': path.resolve(__dirname, './src/'),
'@test/utils': path.resolve(__dirname, './test/utils'),
},
},
test: testConfig,
});