forked from exelearning/exelearning
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvitest.config.mts
More file actions
90 lines (80 loc) · 3.29 KB
/
vitest.config.mts
File metadata and controls
90 lines (80 loc) · 3.29 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
import { defineConfig } from 'vitest/config';
export default defineConfig({
resolve: {
alias: {
// Allow tests to import from 'bun:test' - redirect to vitest
'bun:test': 'vitest',
},
},
test: {
// Enable globals (describe, it, expect) without imports
globals: true,
// Use happy-dom for all frontend tests (provides window, document, etc.)
environment: 'happy-dom',
// Setup file for mocks
setupFiles: ['./public/vitest.setup.js'],
// Only include frontend tests
include: ['public/app/**/*.test.js', 'public/libs/**/*.test.js', 'public/files/perm/idevices/**/*.test.js', 'public/preview-sw.test.js'],
// Exclude legacy code
exclude: [
'**/node_modules/**',
'**/symfony_legacy/**',
'**/nestjs_legacy/**',
'public/app/common/edicuatex/**/!(*.test).js',
'public/app/common/edicuatex/**/*.css',
'public/app/common/edicuatex/**/*.html',
'public/app/common/edicuatex/**/*.json',
'public/app/common/mermaid/**',
'public/app/common/mindmaps/**',
'public/app/common/fix_webm_duration/**',
'public/app/common/exe_tooltips/imagesloaded.pkg.min.js',
'public/app/common/exe_tooltips/jquery.qtip.min.js',
'public/app/common/exe_media/**',
'public/app/common/exe_math/**',
'public/app/common/exe_magnify/**',
'public/app/common/exe_lightbox/**',
'public/app/common/exe_highlighter/**',
'public/files/perm/themes/**',
],
// Worker isolation - critical for memory management
pool: 'threads',
singleFork: false,
isolate: true,
// Limit concurrent tests to prevent memory explosion
maxConcurrency: 4,
// Timeout for slow tests
testTimeout: 30000,
// Silence console.log in tests
silent: false,
// Coverage configuration for CI (activated with --coverage flag)
coverage: {
provider: 'v8',
reporter: ['text', 'lcov'],
reportsDirectory: './coverage/vitest',
include: ['public/app/**/*.js'],
exclude: [
'**/node_modules/**',
'**/*.test.js',
'**/vitest.setup.js',
'**/libs/**',
'**/*.min.js',
'**/*.bundle.js',
'public/app/common/mermaid/**',
'public/app/common/mindmaps/**',
'public/app/common/fix_webm_duration/**',
'public/app/common/exe_tooltips/imagesloaded.pkg.min.js',
'public/app/common/exe_tooltips/jquery.qtip.min.js',
'public/app/common/exe_media/**',
'public/app/common/exe_math/**',
'public/app/common/exe_magnify/**',
'public/app/common/exe_lightbox/**',
'public/app/common/exe_highlighter/**',
'public/app/common/edicuatex/**/!(*.test).js',
'public/app/common/edicuatex/**/*.css',
'public/app/common/edicuatex/**/*.html',
'public/app/common/edicuatex/**/*.json',
'public/files/perm/**',
],
},
},
});