forked from Tencent/tdesign-vue
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vitest.config.js
44 lines (42 loc) · 1.17 KB
/
vitest.config.js
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
import path from 'path';
import { defineConfig } from 'vite';
import { createVuePlugin } from 'vite-plugin-vue2';
import ScriptSetup from 'unplugin-vue2-script-setup/vite';
const testConfig = {
exclude: ['src/**/__tests__/demo.test.js'],
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: 5000,
setupFiles: ['script/test/setup.js'],
transformMode: {
web: [/\.[jt]sx$/],
},
coverage: {
include: ['src'],
reporter: ['text', 'json', 'html'],
reportsDirectory: 'test/unit/coverage',
},
};
export default defineConfig({
resolve: {
alias: {
'@': path.resolve(__dirname, './'),
'tdesign-vue/es': path.resolve(__dirname, './src'),
'tdesign-vue': path.resolve(__dirname, './src'),
'@test/utils': path.resolve(__dirname, './test/utils'),
vue: 'vue/dist/vue.runtime.common.js',
},
},
plugins: [
createVuePlugin({
include: /(\.md|\.vue)$/,
jsx: true,
}),
ScriptSetup({}),
],
test: testConfig,
});