Repository navigation
Expand file tree
/
Copy pathvitest.config.mts
More file actions
55 lines (50 loc) · 1.5 KB
/
Copy pathvitest.config.mts
File metadata and controls
55 lines (50 loc) · 1.5 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import path from 'path';
import { defineConfig } from 'vitest/config';
import pkg from './packages/tdesign-react/package.json';
import type { 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}']
: [
'packages/components/**/__tests__/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}',
'packages/pro-components/**/__tests__/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}',
],
globals: true,
environment: 'jsdom',
testTimeout: 16000,
testTransformMode: {
web: ['\\.[jt]sx$'],
},
coverage: {
provider: 'istanbul',
reporter: ['text', 'json', 'html'],
reportsDirectory: 'test/coverage',
exclude: [
'**/__tests__/**',
'**/*.{test,spec}.{ts,tsx}',
'**/_example/**',
'**/_example-js/**',
'**/node_modules/**',
'packages/pro-components/**',
],
},
typecheck: {
tsconfig: './tsconfig.vitest.json',
},
};
export default defineConfig({
define: {
__VERSION__: JSON.stringify(pkg.version),
},
resolve: {
alias: {
'tdesign-react/es': path.resolve(__dirname, './packages/components'),
'tdesign-react': path.resolve(__dirname, './packages/components'),
'@test/utils': path.resolve(__dirname, './test/utils'),
'@tdesign-react/chat': path.resolve(__dirname, './packages/pro-components/chat'),
},
},
test: testConfig,
});