Jest plugin to use Babel for transformation of source files during testing. Current stable version is 30.3.0 (released 2025). It is part of the Jest monorepo and follows Jest's release cadence. Key differentiators: integrates tightly with Jest's transform pipeline, automatically picks up Babel configuration, supports custom transformers and presets, and is ESM-compatible. It is the recommended way to transpile modern JavaScript and TypeScript code in Jest tests when using Babel. Compared to alternative transformers like ts-jest, babel-jest is faster but does not perform type checking.
npm install babel-jestVerified import paths — ran on the pinned version, not inferred.
Configures babel-jest as the transformer for .js/.ts files in Jest, using createTransformer with custom Babel presets.
Use import statements instead of require(). If you must use CommonJS, use dynamic import or upgrade your project to ESM.
Review the changelog for Jest 30 and update custom transformers accordingly.
Replace usage of default export with createTransformer for clarity and future-proofing.
Add a separate type check step in your CI or use the TypeScript compiler as a separate test.
Ensure you are using import statements and that the transform is correctly set (e.g., use 'import babelJest from "babel-jest"').
Run 'npm install --save-dev @babel/core' or 'yarn add --dev @babel/core'.
Upgrade to babel-jest v28+ and use 'import { createTransformer } from "babel-jest"'.Add 'type': 'module' to package.json, or rename file to .mjs, or use require syntax for CJS.