forked from meza/trance-stack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vitest.config.ts
65 lines (62 loc) · 1.49 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
63
64
65
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: {
globals: true,
isolate: true,
environment: 'happy-dom',
cache: {
dir: '.cache/.vitest'
},
deps: {
fallbackCJS: true
},
setupFiles: ['./vitest.setup.ts'],
dir: 'src',
testTimeout: 10000,
watch: false,
threads: false,
outputFile: 'reports/junit.xml',
reporters: testReporters,
coverage: {
// excludeNodeModules: true,
src: ['src'],
include: ['**/*.ts', '**/*.tsx'],
exclude: [
'**/__mocks__/**.*',
'**/*.d.ts',
'**/*.test.ts',
'**/*.test.tsx',
'**/*.stories.mdx',
'**/*.stories.tsx',
'testUtils/**.*'
],
all: true,
reportsDirectory: './reports/coverage/unit',
reporter: coverageReporters,
statements: 100,
branches: 100,
functions: 100,
lines: 100
}
},
resolve: {
alias: {
'~': path.resolve(__dirname, './src')
}
}
});