Configuring Jest with Typescript in a React app

Install the TypeScript Jest preprocessor and the Jest type definitions.

npm i  --save ts-jest @types/jest

Update the package.json and add the following cofiguration

To the jest.testMatch section:

"/src/**/?(*.)(spec|test).{ts,tsx}"

To the jest.transform section:

".(ts|tsx)": "/node_modules/ts-jest/preprocessor.js",

To the jest.moduleFileExtensions section:

"ts", "tsx",