-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathvitest.config.js
More file actions
108 lines (93 loc) · 2.63 KB
/
Copy pathvitest.config.js
File metadata and controls
108 lines (93 loc) · 2.63 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
103
104
105
106
107
108
/**
* Vitest Configuration for Parsec Equations Library
*
* This configuration sets up Vitest for testing the equations-parser WebAssembly
* integration with comprehensive test coverage and modern testing practices.
*/
import { defineConfig } from 'vitest/config'
import path from 'path'
export default defineConfig({
test: {
// Test file patterns
include: ['tests/**/*.{test,spec}.{js,mjs,ts}', 'tests/**/*.bench.{js,mjs,ts}'],
exclude: [
'tests/test-runner.html',
'tests/simple-test.html',
'tests/debug-test.html',
'tests/*.html',
'node_modules/**',
'dist/**',
],
// Test environment
environment: 'jsdom', // Use jsdom for DOM APIs if needed
// Global setup
globals: true,
// Test execution settings
testTimeout: 10000, // 10 seconds timeout for WASM loading
hookTimeout: 10000, // 10 seconds for setup/teardown
// Coverage configuration
coverage: {
provider: 'v8',
reporter: ['text', 'json', 'html', 'lcov'],
reportsDirectory: './coverage',
include: ['js/**/*.js', 'index.js', 'index.mjs'],
exclude: ['tests/**', 'wasm/**', 'html/**', 'cpp/**', 'node_modules/**', 'coverage/**'],
thresholds: {
global: {
branches: 80,
functions: 80,
lines: 80,
statements: 80,
},
},
},
// Browser-like environment configuration
// This helps with WebAssembly module loading
server: {
deps: {
// Inline dependencies that might have issues
inline: [/equations_parser_wrapper/],
},
},
// Mock WebAssembly environment if needed
setupFiles: ['./tests/setup.js'],
// Reporting
reporter: ['verbose', 'json'],
outputFile: {
json: './test-results.json',
},
// Test running behavior
watch: false, // Set to true for watch mode by default
run: true,
// Pool options for parallel execution
pool: 'threads',
poolOptions: {
threads: {
singleThread: false,
maxThreads: 4,
minThreads: 1,
},
},
// File system watching (for watch mode)
watchExclude: ['node_modules/**', 'dist/**', 'coverage/**', 'wasm/**/*.wasm', '*.log'],
},
// Resolve configuration
resolve: {
alias: {
'@': path.resolve(__dirname, './js'),
'@tests': path.resolve(__dirname, './tests'),
'@wasm': path.resolve(__dirname, './wasm'),
},
},
// Define global constants
define: {
__TEST_ENV__: true,
__VERSION__: JSON.stringify('1.0.0'),
},
// Server options for serving static files during testing
server: {
fs: {
allow: ['.'],
},
},
})