Files
F-r-ldraledigplannerare/frontend/vitest.config.ts
T
jacobh2 ed5680253e Check in a browser what the unit tests cannot see
Every serious defect in this project was found by opening the app, most
recently a feature that rendered blank cards to every user while its tests
passed, and a progress bar labelled in the wrong unit. Five checks now run
without a person: that the age-four figures on screen match what the API
computed, that a multi-week period draws as one bar rather than fragments,
that Sundays and holidays are red where Saturdays are not, that no identifier
leaks into visible text, and that no page logs an error.

Three of them were confirmed by reintroducing the original bug and watching
the right test fail. Dates are derived rather than written down: Easter is
computed independently instead of asked of the system under test, and the
fixture period is placed relative to today, so the suite does not expire.

It runs as its own job and does not block a merge until it has proved itself
stable.
2026-09-17 19:46:17 +02:00

43 lines
1.2 KiB
TypeScript

import { configDefaults, defineConfig } from 'vitest/config'
import react from '@vitejs/plugin-react'
import { resolve } from 'path'
export default defineConfig({
plugins: [react()],
resolve: {
alias: {
'@': resolve(__dirname, 'src'),
},
},
test: {
globals: true,
environment: 'jsdom',
setupFiles: ['./tests/setup.ts'],
// The Playwright E2E suite lives under e2e/ and uses @playwright/test's
// own test runner (`npm run e2e`), not Vitest's — exclude it here so
// `vitest run` never tries to collect those specs.
exclude: [...configDefaults.exclude, 'e2e/**'],
coverage: {
provider: 'v8',
reporter: ['text', 'lcov'],
// Thresholds set as a regression ratchet to prevent coverage from dropping.
// Measured: lines 97.27%, functions 92.87%, statements 97.27%, branches 93.78%.
// Set ~1-2pp below measured to catch real regressions without false positives.
thresholds: {
lines: 96,
functions: 91,
branches: 92,
statements: 96,
},
include: ['src/**/*.{ts,tsx}'],
exclude: [
'src/main.tsx',
'src/vite-env.d.ts',
'src/types/**',
'**/*.test.ts',
'**/*.test.tsx',
],
},
},
})