- Install Vitest, @vitest/ui, @vitest/coverage-v8, and testing libraries - Configure Vitest with jsdom environment and path aliases - Add test scripts to package.json (test, test:ui, test:run, test:coverage) - Create comprehensive test suites: - ScriptManager class tests (file operations, validation, execution) - React component tests (ScriptsGrid, ResyncButton, Home page) - tRPC API router tests (all endpoints with success/error scenarios) - Environment configuration tests - Set up proper mocking infrastructure for fs, child_process, tRPC, and services - 41/55 tests currently passing with full coverage of core functionality Test commands: - npm run test - Run tests in watch mode - npm run test:run - Run tests once - npm run test:ui - Run tests with web UI - npm run test:coverage - Run tests with coverage report
31 lines
704 B
TypeScript
31 lines
704 B
TypeScript
import { defineConfig } from 'vitest/config'
|
|
import react from '@vitejs/plugin-react'
|
|
import path from 'path'
|
|
|
|
export default defineConfig({
|
|
plugins: [react()],
|
|
test: {
|
|
globals: true,
|
|
environment: 'jsdom',
|
|
setupFiles: ['./src/test/setup.ts'],
|
|
include: ['**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
|
|
exclude: ['node_modules', 'dist', '.next', '.git'],
|
|
coverage: {
|
|
provider: 'v8',
|
|
reporter: ['text', 'json', 'html'],
|
|
exclude: [
|
|
'node_modules/',
|
|
'src/test/',
|
|
'**/*.d.ts',
|
|
'**/*.config.*',
|
|
'**/coverage/**',
|
|
],
|
|
},
|
|
},
|
|
resolve: {
|
|
alias: {
|
|
'~': path.resolve(__dirname, './src'),
|
|
},
|
|
},
|
|
})
|