Skip to content

james-greenwood/ts-jest-playground

This branch is up to date with NathanKr/ts-jest-playground:main.

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

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 57.7%
  • JavaScript 42.3%