test: add vitest test infrastructure and configuration

- Add vitest.config.ts with coverage thresholds
- Add test/setup.ts with testing-library setup
- Add test/helpers.ts with test utilities
This commit is contained in:
Millian Lamiaux
2026-03-14 20:42:22 +01:00
parent 52429d957f
commit 592d04e170
3 changed files with 253 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
import { defineConfig } from 'vitest/config'
import react from '@vitejs/plugin-react'
import path from 'path'
export default defineConfig({
plugins: [react()],
test: {
environment: 'jsdom',
globals: true,
setupFiles: ['./test/setup.ts'],
include: ['**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
coverage: {
provider: 'v8',
reporter: ['text', 'json', 'html'],
exclude: [
'node_modules/',
'test/',
'**/*.d.ts',
'**/*.config.*',
'**/mock/**',
],
thresholds: {
lines: 88,
functions: 90,
branches: 78,
statements: 85,
},
},
testTimeout: 30000,
hookTimeout: 30000,
},
resolve: {
alias: {
'@': path.resolve(__dirname, './'),
},
},
})