The base tsconfig.json had types: ["vitest/globals", "@testing-library/jest-dom/vitest"] which are devDependencies only installed during development. CI production builds with npm ci --production don't include these, causing TS2688 errors. Solution: Remove types array from tsconfig.json (let TS auto-discover available types) Simplify tsconfig.build.json to only exclude test files Add triple-slash type references to test setup file Add typecheck config to vitest.config.ts This ensures: Production builds work without devDependencies Test files still have proper type definitions No JSX.IntrinsicElements errors from missing React types
36 lines
858 B
TypeScript
36 lines
858 B
TypeScript
import { defineConfig } from 'vitest/config'
|
|
import react from '@vitejs/plugin-react'
|
|
|
|
export default defineConfig({
|
|
plugins: [react()],
|
|
test: {
|
|
pool: 'threads',
|
|
globals: true,
|
|
environment: 'jsdom',
|
|
setupFiles: './src/test/setup.ts',
|
|
// TypeScript types for test globals - these are automatically available in test files
|
|
typecheck: {
|
|
tsconfig: './tsconfig.json',
|
|
},
|
|
exclude: [
|
|
'node_modules/**',
|
|
'dist/**',
|
|
'e2e/**', // Playwright E2E tests - run separately
|
|
'tests/**', // Playwright smoke tests - run separately
|
|
],
|
|
coverage: {
|
|
provider: 'v8',
|
|
reporter: ['text', 'json', 'html'],
|
|
exclude: [
|
|
'node_modules/',
|
|
'src/test/',
|
|
'**/*.d.ts',
|
|
'**/*.config.*',
|
|
'**/mockData.ts',
|
|
'dist/',
|
|
'e2e/',
|
|
],
|
|
},
|
|
},
|
|
})
|