mirror of
https://github.com/run-llama/auto_rfp.git
synced 2026-07-21 03:55:24 -04:00
f912ce15de
- 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
42 lines
1.0 KiB
TypeScript
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,
|
|
},
|
|
});
|