Files
Charon/frontend/vitest.config.ts
GitHub Actions 24c8deff7a fix: increase memory limit for vitest and improve test stability
- Updated test scripts in package.json to set NODE_OPTIONS for increased memory limit.
- Added safety checks for remote servers and domains in ProxyHostForm component to prevent errors.
- Refactored Notifications tests to remove unnecessary use of fake timers and improve clarity.
- Updated ProxyHosts extra tests to specify button names for better accessibility.
- Enhanced Security functional tests by centralizing translation strings and improving mock implementations.
- Adjusted test setup to suppress specific console errors related to act() warnings.
- Modified vitest configuration to limit worker usage and prevent memory issues during testing.
2026-02-16 09:24:52 +00:00

54 lines
1.4 KiB
TypeScript

import { defineConfig } from 'vitest/config'
import react from '@vitejs/plugin-react'
// Dynamic coverage threshold (align local and CI)
const coverageThresholdValue =
process.env.CHARON_MIN_COVERAGE ?? process.env.CPM_MIN_COVERAGE ?? '85.0'
const coverageThreshold = Number.parseFloat(coverageThresholdValue)
const resolvedCoverageThreshold = Number.isNaN(coverageThreshold) ? 85.0 : coverageThreshold
export default defineConfig({
plugins: [react()],
test: {
pool: 'forks',
maxWorkers: 1,
minWorkers: 1,
globals: true,
environment: 'jsdom',
environmentOptions: {
jsdom: {
url: 'http://localhost',
},
},
setupFiles: './src/test/setup.ts',
// TypeScript types for test globals - these are automatically available in test files
typecheck: {
tsconfig: './tsconfig.json',
},
exclude: [
'node_modules/**',
'dist/**',
'e2e/**', // Playwright E2E tests - run separately
'tests/**', // Playwright smoke tests - run separately
],
coverage: {
provider: 'v8',
clean: false,
reporter: ['text', 'json', 'html', 'lcov', 'json-summary'],
exclude: [
'node_modules/',
'src/locales/**',
'src/test/',
'**/*.d.ts',
'**/*.config.*',
'**/mockData.ts',
'dist/',
'e2e/',
],
thresholds: {
lines: resolvedCoverageThreshold,
},
},
},
})