You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix Jest config file imports for Jest v30 ESM compatibility
Jest v30 switched to using Node's native ESM loader for config files,
which requires explicit file extensions in imports. This change adds
support for .ts extensions in Jest config file imports while maintaining
proper TypeScript and ESLint integration.
Changes:
- Created tsconfig.jest-config.json: Separate TypeScript config for Jest
config files that enables allowImportingTsExtensions
- Updated tsconfig.json: Added project reference to tsconfig.jest-config.json
and excluded jest.config*.ts files to prevent overlap
- Updated jest.config.*.ts: Changed imports to use explicit .ts extensions
(e.g., import from './jest.config.ts')
- Updated eslint.config.js: Added specific configuration for Jest config
files to use the correct tsconfig and ignore build artifacts
- Updated .gitignore: Added .tsbuildinfo/ to ignore TypeScript build output
Benefits:
- IDE support: IDEs automatically use the correct tsconfig via project references
- Clean imports: No @ts-ignore hacks needed
- Full type checking: All files properly type-checked
- All test scripts work: test-all, test-mutation, test-private
Technical details:
- Uses TypeScript composite projects with emitDeclarationOnly to satisfy
both the composite requirement and allowImportingTsExtensions constraint
- Jest config files loaded by Node ESM require .ts extensions
- Test files continue to use traditional imports (handled by ts-jest)
0 commit comments