-
-
Notifications
You must be signed in to change notification settings - Fork 15
/
vitest.config.ts
62 lines (59 loc) · 1.43 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import path from 'node:path';
import react from '@vitejs/plugin-react';
import isCi from 'is-ci';
import tsconfigPaths from 'vite-tsconfig-paths';
import { defineConfig } from 'vitest/config';
import type { CoverageReporter } from 'vitest';
const testReporters = ['default'];
const coverageReporters: CoverageReporter[] = ['text'];
if (!isCi) {
// testReporters.push('cobertura');
coverageReporters.push('html');
} else {
testReporters.push('junit');
coverageReporters.push('cobertura');
}
export default defineConfig({
plugins: [react(), tsconfigPaths()],
test: {
cache: {
dir: '.cache/.vitest'
},
coverage: {
include: ['src/**/*.ts', 'src/**/*.tsx'],
exclude: [
'**/__mocks__/**.*',
'**/*.d.ts',
'**/*.test.ts',
'**/*.test.tsx',
'**/*.stories.mdx',
'**/*.stories.tsx',
'testUtils/**.*'
],
all: true,
provider: 'v8',
reportsDirectory: './reports/coverage/unit',
reporter: coverageReporters,
thresholds: {
statements: 100,
branches: 100,
functions: 100,
lines: 100
}
},
dir: 'src',
environment: 'jsdom',
globals: true,
isolate: true,
outputFile: 'reports/junit.xml',
reporters: testReporters,
setupFiles: ['./vitest.setup.ts'],
testTimeout: 10000,
watch: false
},
resolve: {
alias: {
'~': path.resolve(__dirname, './src')
}
}
});