-
Notifications
You must be signed in to change notification settings - Fork 142
/
vitest.config.ts
48 lines (42 loc) · 1.23 KB
/
vitest.config.ts
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
/**
* @license
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://github.com/IDuxFE/idux/blob/main/LICENSE
*/
import { resolve } from 'path'
import vuePlugin from '@vitejs/plugin-vue'
import vueJsxPlugin from '@vitejs/plugin-vue-jsx'
// eslint-disable-next-line import/no-unresolved
import { defineConfig } from 'vitest/config'
export default defineConfig({
plugins: [vuePlugin({ include: [/\.vue$/, /\.md$/] }), vueJsxPlugin({ enableObjectSlots: false })],
resolve: {
alias: [
{ find: /^@idux(.*)$/, replacement: resolve(__dirname, './packages$1') },
{ find: /^@tests(.*)$/, replacement: resolve(__dirname, './tests$1') },
],
},
test: {
watch: false,
globals: true,
environment: 'jsdom',
transformMode: {
web: [/\.[jt]sx$/],
},
setupFiles: [resolve(__dirname, './tests/setup.ts')],
coverage: {
enabled: true,
reporter: ['json', 'lcov', 'cobertura'],
include: ['**/src/*.{ts,tsx}'],
exclude: [],
},
reporters: ['default'],
// 如果要测试单目录,可以修改这个配置
include: ['**/__tests__/*.spec.{ts,tsx}'],
},
define: {
__DEV__: true,
__TEST__: true,
},
})