-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathvitest.config.ts
More file actions
52 lines (50 loc) · 1.37 KB
/
vitest.config.ts
File metadata and controls
52 lines (50 loc) · 1.37 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
/// <reference types="vitest" />
import * as fs from 'fs'
import * as path from 'path'
import type { Plugin } from 'vite'
import { defineConfig } from 'vitest/config'
/** Vite plugin: load *.tmpl.js files as plain-text string exports. */
function textLoaderPlugin(): Plugin {
return {
name: 'tmpl-js-text-loader',
transform(_code, id) {
if (id.endsWith('.tmpl.js')) {
const content = fs.readFileSync(id, 'utf8')
return { code: `export default ${JSON.stringify(content)}` }
}
},
}
}
export default defineConfig({
plugins: [textLoaderPlugin()],
test: {
globals: true,
reporters: ['html', 'default'],
exclude: ['node_modules', './build', './__e2e__'],
setupFiles: ['./__tests__/setupTests.ts'],
testTimeout: 200000,
hookTimeout: 200000,
// Enable parallel execution for faster test runs
poolOptions: {
threads: {
maxThreads: 6, // Use more threads on 8-core runner
minThreads: 2,
},
forks: {
isolate: true,
execArgv: ['--max-old-space-size=4096'],
},
},
coverage: {
exclude: ['node_modules', './build', 'vitest.config.ts'],
provider: 'v8',
reporter: ['html', 'text', 'lcov', 'json', 'lcovonly'],
reportsDirectory: 'coverage',
},
},
resolve: {
alias: {
'@mobb/bugsy': path.resolve(__dirname, './src'),
},
},
})