-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathvitest.config.ts
More file actions
80 lines (79 loc) · 2.18 KB
/
vitest.config.ts
File metadata and controls
80 lines (79 loc) · 2.18 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
import { defineConfig } from 'vitest/config';
import preact from '@preact/preset-vite';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import tsconfigPaths from 'vite-tsconfig-paths';
export default defineConfig({
resolve: {
alias: {
'@client': path.resolve(
path.dirname(fileURLToPath(import.meta.url)),
'src/client'
),
'@components': path.resolve(
path.dirname(fileURLToPath(import.meta.url)),
'src/client/components'
),
'@utils': path.resolve(
path.dirname(fileURLToPath(import.meta.url)),
'src/client/utils'
),
'@hooks': path.resolve(
path.dirname(fileURLToPath(import.meta.url)),
'src/client/hooks'
),
'@src': path.resolve(path.dirname(fileURLToPath(import.meta.url)), 'src'),
'@server': path.resolve(
path.dirname(fileURLToPath(import.meta.url)),
'src/server'
),
'@shared': path.resolve(
path.dirname(fileURLToPath(import.meta.url)),
'src/shared'
),
react: 'preact/compat',
'react-dom/test-utils': 'preact/test-utils',
'react-dom': 'preact/compat',
'react-dom/client': 'preact/compat',
'react/jsx-runtime': 'preact/jsx-runtime',
'react/jsx-dev-runtime': 'preact/jsx-dev-runtime',
},
},
plugins: [preact(), tsconfigPaths()],
test: {
globals: true,
exclude: ['node_modules', 'dist'],
environment: 'jsdom',
setupFiles: ['src/client/test-setup.ts', 'src/server/test-setup.ts'],
testTimeout: 10000,
hookTimeout: 10000,
mockReset: true,
restoreMocks: true,
clearMocks: true,
isolate: true,
pool: 'threads',
coverage: {
provider: 'v8',
reporter: ['text', 'json-summary', 'html'],
reportsDirectory: '.coverage',
exclude: [
'node_modules/',
'dist/',
'**/*.test.ts',
'**/*.test.tsx',
'**/types/',
'**/*.d.ts',
'src/client/index.tsx',
'src/server/index.ts',
'**/test-setup.ts',
'**/*.config.ts',
],
thresholds: {
lines: 70,
functions: 70,
branches: 70,
statements: 70,
},
},
},
});