- Fix vitest.config.ts React alias to point to local node_modules
instead of nonexistent ancestor path (../../../../node_modules/react)
- Remove stale HQWaitingForInputSection tests (component was deleted
in e8d332e0 but test cases were left behind)
44 lines
1.5 KiB
TypeScript
44 lines
1.5 KiB
TypeScript
import { defineConfig } from 'vitest/config';
|
|
import react from '@vitejs/plugin-react';
|
|
import path from 'node:path';
|
|
|
|
export default defineConfig({
|
|
plugins: [react()],
|
|
resolve: {
|
|
// Ensure all React imports resolve to the same copy, preventing
|
|
// duplicate-React errors (mismatched ReactSharedInternals / hook dispatcher).
|
|
alias: {
|
|
'@': path.resolve(__dirname, './apps/web/src'),
|
|
react: path.resolve(__dirname, 'node_modules/react'),
|
|
'react-dom': path.resolve(__dirname, 'node_modules/react-dom'),
|
|
},
|
|
dedupe: ['react', 'react-dom'],
|
|
},
|
|
test: {
|
|
// Force react-dom and @testing-library through Vite's module graph so that
|
|
// the resolve.alias for 'react-dom' applies (prevents parent-monorepo
|
|
// react-dom loading a different React instance than our source files).
|
|
deps: {
|
|
inline: ['react-dom', '@testing-library/react'],
|
|
},
|
|
// Enable test globals (describe, it, expect without imports)
|
|
globals: true,
|
|
env: {
|
|
CW_LOG_LEVEL: 'silent',
|
|
},
|
|
// Test file pattern
|
|
include: ['**/*.test.ts', '**/*.test.tsx'],
|
|
exclude: ['**/node_modules/**', '**/dist/**', 'packages/**', 'workdir/**'],
|
|
environmentMatchGlobs: [
|
|
['apps/web/**', 'happy-dom'],
|
|
],
|
|
// TypeScript support uses tsconfig.json automatically
|
|
// Coverage reporter (optional, for future use)
|
|
coverage: {
|
|
provider: 'v8',
|
|
reporter: ['text', 'json', 'html'],
|
|
reportsDirectory: './apps/server/coverage',
|
|
},
|
|
},
|
|
});
|