Files
auto_rfp/vitest.config.ts
blank-black f912ce15de Add Vitest testing infrastructure with 173 unit tests
- Configure Vitest with coverage reporting and path aliases
- Add test scripts (test, test:run, test:coverage) to package.json
- Install vitest, @vitest/coverage-v8, vite-tsconfig-paths, vitest-mock-extended

Test coverage includes:
- validators: extract-questions, generate-response, llamaparse, multi-step-response
- errors: all API error classes with type guard
- services: FileValidator (file type/size validation), DefaultResponseService
- middleware: apiHandler and withApiHandler request validation

Add mock infrastructure for Prisma, OpenAI, and test fixtures
2025-12-26 11:41:08 -06:00

42 lines
1.0 KiB
TypeScript

import { defineConfig } from 'vitest/config';
import react from '@vitejs/plugin-react';
import tsconfigPaths from 'vite-tsconfig-paths';
export default defineConfig({
plugins: [react(), tsconfigPaths()],
test: {
globals: true,
environment: 'node',
setupFiles: ['./vitest.setup.ts'],
include: ['tests/**/*.test.ts'],
exclude: ['node_modules', '.next', 'dist'],
coverage: {
provider: 'v8',
reporter: ['text', 'html', 'lcov'],
reportsDirectory: './coverage',
include: [
'lib/services/**/*.ts',
'lib/validators/**/*.ts',
'lib/errors/**/*.ts',
'lib/utils/**/*.ts',
'lib/middleware/**/*.ts',
],
exclude: [
'lib/db.ts',
'lib/utils/supabase/**',
'**/*.d.ts',
'**/index.ts',
],
// Initial thresholds - will increase as more tests are added
thresholds: {
lines: 10,
functions: 10,
branches: 5,
statements: 10,
},
},
testTimeout: 10000,
hookTimeout: 10000,
},
});