headplane/vitest.config.ts

83 lines
1.7 KiB
TypeScript
Raw Normal View History

import { resolve } from 'node:path';
import { defineConfig } from 'vitest/config';
export default defineConfig({
test: {
// Test environment configuration
environment: 'node',
globals: true,
clearMocks: true,
restoreMocks: true,
// Test file patterns (keeping existing + adding new auth tests)
include: [
'tests/**/*.test.js',
'src/test/**/*.test.{ts,js}',
'src/test/**/*.spec.{ts,js}',
],
exclude: ['node_modules/**', 'build/**', 'dist/**', 'coverage/**'],
// Setup files (keeping existing + adding new setup)
setupFiles: ['./tests/setupOverlayFs.js', './src/test/setup.ts'],
// Coverage configuration for auth system
coverage: {
provider: 'v8',
reporter: ['text', 'html', 'json'],
reportsDirectory: 'coverage',
exclude: [
'node_modules/',
'dist/',
'coverage/',
'src/test/',
'tests/',
'**/*.d.ts',
'**/*.config.{ts,js}',
'src/pages/**/*', // Exclude Astro pages (integration tested)
],
thresholds: {
global: {
branches: 75,
functions: 75,
lines: 75,
statements: 75,
},
},
},
// Test timeout and reporting
testTimeout: 10000,
reporter: ['verbose'],
// Mock configuration
mockReset: true,
// Disable file watching in CI
watch: false,
// Pool options for parallel execution
pool: 'forks',
poolOptions: {
forks: {
singleFork: false,
minForks: 1,
maxForks: 4,
},
},
},
// Path resolution (keeping existing + adding src paths)
resolve: {
alias: {
'~': resolve(__dirname, './app'),
'~/src': resolve(__dirname, './src'),
'~server/': resolve(__dirname, './server/'),
},
},
// ESBuild configuration for TypeScript
esbuild: {
target: 'node18',
},
});