- Added IDs to input fields in CrowdSecConfig for better accessibility. - Updated labels to use <label> elements for checkboxes and inputs. - Improved error handling and user feedback in the CrowdSecConfig tests. - Enhanced test coverage for console enrollment and banned IP functionalities. fix: Update SecurityHeaders to include aria-label for delete button - Added aria-label to the delete button for better screen reader support. test: Add comprehensive tests for proxyHostsHelpers and validation utilities - Implemented tests for formatting and help text functions in proxyHostsHelpers. - Added validation tests for email and IP address formats. chore: Update vitest configuration for dynamic coverage thresholds - Adjusted coverage thresholds to be dynamic based on environment variables. - Included additional coverage reporters. chore: Update frontend-test-coverage script to reflect new coverage threshold - Increased minimum coverage requirement from 85% to 87.5%. fix: Ensure tests pass with consistent data in passwd file - Updated tests/etc/passwd to ensure consistent content.
49 lines
1.4 KiB
TypeScript
49 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 ?? '87.5'
|
|
const coverageThreshold = Number.parseFloat(coverageThresholdValue)
|
|
const resolvedCoverageThreshold = Number.isNaN(coverageThreshold) ? 87.5 : coverageThreshold
|
|
|
|
export default defineConfig({
|
|
plugins: [react()],
|
|
test: {
|
|
pool: 'threads',
|
|
globals: true,
|
|
environment: 'jsdom',
|
|
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',
|
|
reporter: ['text', 'json', 'html', 'lcov', 'json-summary'],
|
|
exclude: [
|
|
'node_modules/',
|
|
'src/locales/**',
|
|
'src/test/',
|
|
'**/*.d.ts',
|
|
'**/*.config.*',
|
|
'**/mockData.ts',
|
|
'dist/',
|
|
'e2e/',
|
|
],
|
|
thresholds: {
|
|
lines: resolvedCoverageThreshold,
|
|
functions: resolvedCoverageThreshold,
|
|
branches: resolvedCoverageThreshold,
|
|
statements: resolvedCoverageThreshold,
|
|
},
|
|
},
|
|
},
|
|
})
|