ts-jest is a Jest transformer with source map support that enables testing projects written in TypeScript using Jest. It supports all TypeScript features, including type-checking. The current stable version is 29.4.9. Note that ts-jest does not follow semantic versioning, which means major breaking changes can occur without a corresponding major version increment. Releases are frequent, primarily for patch updates.
npm install ts-jestNo compatibility data collected yet for this library.
This quickstart shows how to set up `ts-jest` for a basic TypeScript project. It includes the necessary `package.json` dependencies and `scripts`, a minimal `jest.config.ts` (generated via `npx ts-jest config:init`), a simple TypeScript function, and its corresponding test file. After installation and configuration, tests can be run using `npm test`.
Always review the CHANGELOG.md before upgrading ts-jest, especially across minor versions, and thoroughly test your application after any update.
Ensure that your installed versions of `jest` (`^29.0.0 || ^30.0.0`) and `typescript` (`>=4.3 <7`) match the peer dependency range specified by ts-jest.
Choose the appropriate tool based on your project's needs. If you require full TypeScript type-checking during tests, `ts-jest` is the correct choice. If you only need fast transpilation without type checks, Babel might be preferred (though often used with other transformers).
Add `preset: 'ts-jest'` to your Jest configuration file, for example: `export default { preset: 'ts-jest' };`Install all necessary peer dependencies explicitly using `npm install -D jest typescript @types/jest ts-jest` (or `yarn add --dev ...`) and ensure their versions fall within the ranges specified by `ts-jest`.
Verify that your `jest` and `typescript` versions satisfy `ts-jest`'s peer dependency requirements. Try clearing your `node_modules` and `npm cache clean --force` (or `yarn cache clean`), then reinstall dependencies.
Address the specific TypeScript errors in your source or test files. Ensure your `tsconfig.json` (especially `compilerOptions` like `target`, `module`, `strict`) is correctly configured for your project and `ts-jest`.
No dependency data recorded yet.