forked from Tencent/tdesign-mobile-react
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vitest.config.mts
34 lines (32 loc) · 1005 Bytes
/
vitest.config.mts
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
import path from 'path';
import { defineConfig } from 'vitest/config';
import { InlineConfig } from 'vitest';
// 单元测试相关配置
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,
transformMode: {
web: [/\.[jt]sx$/],
},
coverage: {
provider: 'istanbul',
exclude: ['src/**.{js,ts}', 'src/_common/**', 'src/_util/**', 'src/**/{__test__,_example,style}/**'],
reporter: ['text', 'json', 'html'],
reportsDirectory: 'test/coverage',
},
};
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,
});