- Install @vitest/coverage-v8 as devDependency (13 packages) - Add coverage block to vite.config.ts test config: - provider: 'v8' (Node.js native coverage, faster than istanbul) - reporters: text, html, lcov, json - thresholds: 70% lines, 60% branches, 70% functions, 70% statements - exclude: test files and e2e directory - Add "test:coverage": "vitest run --coverage" script to package.json - Coverage report output: frontend/coverage/index.html JSON output: frontend/coverage/coverage-final.json - Thresholds are enforced by vitest itself — build exits non-zero if any threshold is not met
36 lines
828 B
TypeScript
36 lines
828 B
TypeScript
/// <reference types="vitest/config" />
|
|
import { fileURLToPath, URL } from 'node:url'
|
|
import { defineConfig } from 'vite'
|
|
import vue from '@vitejs/plugin-vue'
|
|
|
|
export default defineConfig({
|
|
plugins: [vue()],
|
|
resolve: {
|
|
alias: {
|
|
'@': fileURLToPath(new URL('./src', import.meta.url)),
|
|
},
|
|
},
|
|
server: {
|
|
port: 3000,
|
|
proxy: {
|
|
'/api': 'http://backend:8080',
|
|
},
|
|
},
|
|
test: {
|
|
environment: 'jsdom',
|
|
setupFiles: ['src/__tests__/setup.ts'],
|
|
exclude: ['e2e/**', 'node_modules/**'],
|
|
coverage: {
|
|
provider: 'v8',
|
|
reporter: ['text', 'html', 'lcov', 'json'],
|
|
reportsDirectory: './coverage',
|
|
thresholds: {
|
|
lines: 70,
|
|
branches: 60,
|
|
functions: 70,
|
|
statements: 70,
|
|
},
|
|
exclude: ['src/__tests__/**', 'e2e/**'],
|
|
},
|
|
},
|
|
})
|