import { defineConfig } from 'vitest/config';
import { resolve } from 'path';
export default defineConfig({
test: {
// Test environment
environment: 'node',
// Global test setup
globals: true,
// Coverage configuration
coverage: {
provider: 'v8',
reporter: ['text', 'json', 'html', 'lcov'],
exclude: [
'node_modules/',
'dist/',
'tests/',
'**/*.test.ts',
'**/*.spec.ts',
'vitest.config.ts',
'test-*.js',
'scripts/**',
'src/http-server-cli.ts',
],
all: true,
thresholds: {
global: {
lines: 80,
statements: 80,
branches: 80,
functions: 80,
},
each: {
lines: 75,
statements: 75,
branches: 75,
functions: 75,
},
},
},
// Test file patterns
include: [
'tests/**/*.test.ts',
'tests/**/*.spec.ts',
],
// Exclude patterns
exclude: [
'node_modules',
'dist',
'.idea',
'.git',
'.cache',
],
// Test timeout
testTimeout: 10000,
hookTimeout: 10000,
// Reporters
reporters: ['verbose'],
// Separate test types
sequence: {
shuffle: false,
},
// Mock configuration
mockReset: true,
restoreMocks: true,
clearMocks: true,
},
resolve: {
alias: {
'@': resolve(__dirname, './src'),
'@tests': resolve(__dirname, './tests'),
},
},
});