-
Notifications
You must be signed in to change notification settings - Fork 647
Expand file tree
/
Copy pathvitest.config.ts
More file actions
91 lines (88 loc) · 2.69 KB
/
vitest.config.ts
File metadata and controls
91 lines (88 loc) · 2.69 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
import { defineConfig } from 'vitest/config'
import { resolve } from 'path'
import vue from '@vitejs/plugin-vue'
const isCustomElement = (tag: string) =>
tag === 'voice-agent-widget' || tag.startsWith('ui-resource-renderer')
const vuePlugin = () =>
vue({
template: {
compilerOptions: {
isCustomElement
}
}
})
export default defineConfig({
test: {
globals: true,
// Use projects to define different configurations for main and renderer tests
// This allows each test suite to use the correct alias resolution
projects: [
{
plugins: [vuePlugin()],
test: {
name: 'renderer',
environment: 'jsdom',
include: ['test/renderer/**/*.{test,spec}.{js,ts}'],
setupFiles: ['./test/setup.ts'],
globals: true
},
resolve: {
alias: [
// Renderer process aliases (match electron.vite.config.ts renderer config)
{ find: '@/', replacement: resolve('src/renderer/src/') + '/' },
{ find: '@browser', replacement: resolve('src/renderer/browser/') },
{ find: '@shared', replacement: resolve('src/shared') },
{ find: '@shadcn', replacement: resolve('src/shadcn') },
{ find: 'electron', replacement: resolve('test/mocks/electron.ts') },
{ find: '@electron-toolkit/utils', replacement: resolve('test/mocks/electron-toolkit-utils.ts') }
]
}
},
{
plugins: [vuePlugin()],
test: {
name: 'main',
environment: 'node',
include: ['test/main/**/*.{test,spec}.{js,ts}'],
setupFiles: ['./test/setup.ts'],
globals: true
},
resolve: {
alias: [
// Main process aliases (match electron.vite.config.ts main config)
{ find: '@/', replacement: resolve('src/main/') + '/' },
{ find: '@shared', replacement: resolve('src/shared') },
{ find: 'electron', replacement: resolve('test/mocks/electron.ts') },
{ find: '@electron-toolkit/utils', replacement: resolve('test/mocks/electron-toolkit-utils.ts') }
]
}
}
],
coverage: {
provider: 'v8',
reporter: ['text', 'html', 'lcov'],
reportsDirectory: './coverage',
exclude: [
'node_modules/**',
'dist/**',
'out/**',
'test/**',
'**/*.d.ts',
'scripts/**',
'build/**',
'.vscode/**',
'.git/**'
],
thresholds: {
global: {
branches: 80,
functions: 80,
lines: 80,
statements: 80
}
}
},
testTimeout: 10000,
hookTimeout: 10000
}
})