- Add vitest.config.ts with coverage thresholds - Add test/setup.ts with testing-library setup - Add test/helpers.ts with test utilities
38 lines
798 B
TypeScript
38 lines
798 B
TypeScript
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, './'),
|
|
},
|
|
},
|
|
})
|