Files
KGStudio/vitest.config.ts
T

59 lines
1.2 KiB
TypeScript

/// <reference types="vitest" />
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
export default defineConfig({
plugins: [react()],
test: {
// Use jsdom environment for DOM testing
environment: 'jsdom',
// Global test setup
setupFiles: ['./src/test/setup.ts'],
// Include unit test files co-located with source
include: [
'src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'
],
// Exclude directories
exclude: [
'node_modules',
'dist',
'.git',
'.cache',
'tests/' // Exclude integration/e2e folder for now
],
// Enable global test functions (describe, it, expect)
globals: true,
// Coverage configuration
coverage: {
provider: 'v8',
reporter: ['text', 'json', 'html'],
exclude: [
'node_modules/',
'src/test/',
'**/*.d.ts',
'**/*.config.ts',
'src/main.tsx',
'src/vite-env.d.ts'
],
thresholds: {
global: {
branches: 70,
functions: 70,
lines: 70,
statements: 70
}
}
},
// Test timeout
testTimeout: 10000,
// Retry failed tests once
retry: 1
}
})