-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvitest.config.ts
More file actions
102 lines (95 loc) · 2.44 KB
/
vitest.config.ts
File metadata and controls
102 lines (95 loc) · 2.44 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import react from '@vitejs/plugin-react';
import tsconfigPaths from 'vite-tsconfig-paths';
import { defineConfig } from 'vitest/config';
const rootDir = path.dirname(fileURLToPath(import.meta.url));
export default defineConfig({
plugins: [
react(),
tsconfigPaths({
root: rootDir,
projects: [fileURLToPath(new URL('./tsconfig.json', import.meta.url))],
}),
],
resolve: {
alias: {
'@': rootDir,
'@/components/ui/button': path.resolve(
rootDir,
'./components/ui-modified/button',
),
'@/components/ui/scroll-area': path.resolve(
rootDir,
'./components/ui-modified/scroll-area',
),
},
},
test: {
cache: false, // Disable caching
clearMocks: true,
restoreMocks: true,
setupFiles: ['./tests/setup.tsx'],
coverage: {
include: [
'vitest-example/**/*.tsx',
'lib/**/*.ts',
'hooks/**/*.ts',
'features/**/*.ts',
'features/**/*.tsx',
'components/layout/**/*.tsx',
'components/shared/**/*.tsx',
'app/api/**/*.ts',
],
exclude: [
'lib/db/**',
'lib/pusher/**',
'lib/auth/**',
'lib/cloudinary.ts',
'lib/resend.ts',
'lib/react-query/**',
'lib/data/**',
'lib/api/withAuth.ts',
'lib/logger.ts',
],
provider: 'v8',
reporter: ['text', 'json'],
},
projects: [
{
extends: true,
test: {
name: 'unit',
include: [
'lib/**/*{test,spec}.ts',
'features/**/*{test,spec}.ts',
'app/**/*{test,spec}.ts',
],
exclude: ['hooks/**/*{test,spec}.ts'],
environment: 'node',
},
},
{
extends: true,
test: {
name: 'browser',
include: [
'hooks/**/*{test,spec}.ts',
'hooks/**/*{test,spec}.tsx',
'lib/**/*{test,spec}.tsx',
'features/**/*{test,spec}.tsx',
'components/layout/**/*{test,spec}.tsx',
'components/shared/**/*{test,spec}.tsx',
],
browser: {
enabled: true,
provider: 'playwright',
// https://vitest.dev/guide/browser/playwright
instances: [{ browser: 'chromium', headless: true }],
},
},
},
],
globals: true,
},
});