-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvitest.config.ts
More file actions
52 lines (47 loc) · 1.21 KB
/
vitest.config.ts
File metadata and controls
52 lines (47 loc) · 1.21 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
// SPDX-FileCopyrightText: 2025-2026 caixw
//
// SPDX-License-Identifier: MIT
import Icons from 'unplugin-icons/vite';
import solid from 'vite-plugin-solid';
import { defineConfig } from 'vitest/config';
// 需要排除的文件,同时作用在 test.exclude 和 test.coverage.exclude 字段。
const exclude = [
'**/lib/**',
'**/node_modules/**',
'**/vite.config.ts',
'**/vitest.config.ts',
'**/vitest_setup.ts',
'**/*.{test,spec}.ts',
'**/*.{test,spec}.tsx',
'**/mod.ts',
'**/index.ts',
];
export default defineConfig({
plugins: [
Icons({ compiler: 'solid', scale: 1 }),
solid(), // 必须要有,否则所有测试的 isServer 始终为 true。
],
test: {
projects: [
'packages/core',
'packages/components',
'packages/illustrations',
'packages/admin',
'apps/docs',
'build/vite-plugin-about',
'build/vite-plugin-api',
],
environment: 'jsdom',
exclude: exclude,
coverage: {
enabled: true,
include: ['packages/**/*.{ts,tsx}', 'apps/docs/**/.{ts,tsx}', 'build/vite-plugin-*/**/*.{ts,tsx}'],
clean: false,
reportsDirectory: './coverage',
provider: 'v8',
exclude: exclude,
reporter: [['text'], ['json', { file: 'ts.json' }]],
reportOnFailure: true,
},
},
});