The first render with axe takes up to 7 s on the Raspberry Pi runner, above Vitest's 5 s default; the suite now allows 20 s per test. Also silences the router warning in the test that crashes a page on purpose, and makes the nginx test config return 404 instead of a redirect loop (500) while the test folder is still empty. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
54 lines
1.8 KiB
TypeScript
54 lines
1.8 KiB
TypeScript
/// <reference types="vitest/config" />
|
|
import { defineConfig } from 'vite';
|
|
import react from '@vitejs/plugin-react';
|
|
import { tanstackRouter } from '@tanstack/router-plugin/vite';
|
|
import { securityHeaders } from './config/securityHeaders.ts';
|
|
import sitemapPlugin from './config/sitemapPlugin.ts';
|
|
|
|
// 100% dekking voor de pure functies (NFR-M-02); de rest wordt alleen gerapporteerd
|
|
const fullCoverage = {
|
|
statements: 100,
|
|
branches: 100,
|
|
functions: 100,
|
|
lines: 100,
|
|
};
|
|
|
|
// https://vitejs.dev/config/
|
|
export default defineConfig({
|
|
plugins: [
|
|
// Please make sure that '@tanstack/router-plugin' is passed before '@vitejs/plugin-react'
|
|
tanstackRouter({
|
|
target: 'react',
|
|
autoCodeSplitting: true,
|
|
}),
|
|
react(),
|
|
sitemapPlugin(),
|
|
],
|
|
resolve: {
|
|
tsconfigPaths: true,
|
|
},
|
|
// Dev: zelfde headers, met alleen de uitzonderingen die Vite nodig heeft
|
|
server: { headers: securityHeaders('development') },
|
|
// Preview: de strenge productieset
|
|
preview: { headers: securityHeaders('production') },
|
|
test: {
|
|
environment: 'jsdom',
|
|
// De CI-runner (Raspberry Pi, arm64) is ±5-8x trager dan een pc; de
|
|
// eerste render met axe duurt daar tot 7 s. 5 s (standaard) is te krap.
|
|
testTimeout: 20_000,
|
|
globalSetup: ['./config/testSeed.ts'],
|
|
setupFiles: ['./src/test/setup.ts'],
|
|
css: false,
|
|
coverage: {
|
|
provider: 'v8',
|
|
include: ['src/**/*.{ts,tsx}', 'config/**/*.ts'],
|
|
exclude: ['src/routeTree.gen.ts', 'src/test/**', '**/*.test.*'],
|
|
thresholds: {
|
|
'src/lib/**': fullCoverage,
|
|
'src/seo.ts': fullCoverage,
|
|
'src/sitemap.ts': fullCoverage,
|
|
},
|
|
},
|
|
},
|
|
});
|