feat(ci): add coverage configuration

This commit is contained in:
Tuan-Dat Tran
2026-02-20 17:25:15 +01:00
parent dee36dafd3
commit 278082d322
2 changed files with 32 additions and 0 deletions

View File

@@ -10,6 +10,7 @@
"preview": "vite preview",
"test": "vitest",
"test:run": "vitest run",
"test:coverage": "vitest run --coverage",
"test:integration": "vitest run tests/integration",
"test:regression": "vitest run tests/regression --update",
"test:e2e": "playwright test",

31
vitest.config.js Normal file
View File

@@ -0,0 +1,31 @@
import { defineConfig } from 'vitest/config'
import react from '@vitejs/plugin-react'
export default defineConfig({
plugins: [react()],
test: {
environment: 'jsdom',
globals: true,
setupFiles: ['./src/test/setup.js'],
include: ['src/**/*.{test,spec}.{js,jsx}', 'tests/**/*.{test,spec}.js'],
exclude: ['tests/e2e/**', 'tests/performance/**', 'tests/regression/visual.test.js', 'node_modules/**'],
snapshotFormat: {
escapeString: true,
printBasicPrototype: false,
},
coverage: {
provider: 'v8',
reporter: ['text', 'lcov', 'html'],
exclude: [
'node_modules/',
'tests/',
'**/*.test.js',
'**/*.config.js'
],
lines: 80,
functions: 80,
branches: 80,
statements: 80
},
},
})