Skip to content

Latest commit

 

History

History
33 lines (24 loc) · 1001 Bytes

README.md

File metadata and controls

33 lines (24 loc) · 1001 Bytes

Introduction

using jest with typescript and es-module is not simple. But jest is popular and typescript and es-module are popular. jest does not work out of the box with typescript and es-modules. note the vitest does work out of the box with es module and typescript

Motivation

How to use jest with typescript ? jest documentation suggest two solutions : babel and ts-node. In this repository i will look into ts-jest

using with typescript should solve the jest es module problem - lets see about that

setup

install dependencies

pnpm i -D jest typescript ts-jest @types/jest

create config file

npx ts-jest config:init

add to package.json

    "test": "jest"

usage

npm test

conclusion

using ts-jest work nicely with typescript and es module. the setup is very easy