Jest and TypeScript

Learn how to use Jest for testing TypeScript applications.

TypeScript configuration options

Jest is fully compatible with TypeScript applications, but there are a couple of nuances to this environment. We have two options for configuring Jest with TypeScript: babel and ts-jest. Unless an application is already using a babel configuration in its testing environment, we think that ts-jest is the more straightforward path.

ts-jest

This package, available on our preferred package registry, is a TypeScript processor for Jest. All we need to do is start writing our test files as .test.ts instead of .test.js ...