Skip to content

aleclarson/esbuild-jest

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

56 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

esbuild-jest

npm Code style: Prettier Donate

Jest transformer with esbuild speed

This is a fork of esbuild-jest with the following added features:

  • Sourcemaps enabled by default
  • Strict mode enabled for modules
  • Hoisted jest.mock calls with nebu

Install

yarn add esbuild-jest@npm:@alloc/esbuild-jest esbuild -D

Setting up Jest config file

esbuild-jest transformer should be used in your Jest config file like this:

{
  "transform": {
    "^.+\\.tsx?$": "esbuild-jest"
  }
}

Setting up Jest config file with transformOptions

export interface Options {
  jsxFactory?: string
  jsxFragment?: string
  loaders?: {
    [ext: string]: Loader
  }
  target?: string
}
{
  "transform": {
    "^.+\\.tsx?$": [
      "esbuild-jest",
      {
        loaders: {
          '.spec.ts': 'tsx'
        }
      }
    ]
  }
}

About

A Jest transformer using esbuild

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 92.1%
  • JavaScript 7.9%