Skip to content

NathanKr/ts-jest-playground

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published