8000 GitHub - cayasso/esbuild-jest: A Jest transformer using esbuild
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

cayasso/esbuild-jest

 
 

Repository files navigation

What is the esbuild-jest2?

This is a for of esbuild-jest and it was created because the original project was abandoned and it also includes some changes from another similar projects such like:

Also:

  • support jest v29+;

A Jest transformer using esbuild

With this transformer you can use and transform (ts, js, tsx and jsx) files

Install

npm install --save-dev esbuild-jest2 esbuild

Setting up Jest config file

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

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

Setting up Jest config file with transformOptions

export interface Options {
  jsxFactory?: string
  jsxFragment?: string
  sourcemap?: boolean | 'inline' | 'external'
  loaders?: {
    [ext: string]: Loader
  },
  target?: string
  format?: string
}
{
  "transform": {
    "^.+\\.tsx?$": [ 
      "esbuild-jest2", 
      { 
        sourcemap: true,
        loaders: {
          '.spec.ts': 'tsx'
        }
      } 
    ]
  }
}

Note: if you are using tsconfig.json and jsconfig.json with "paths", Please look alias-hq and there documentation https://github.com/davestewart/alias-hq/blob/master/docs/integrations.md

Authors


Jay Aelbore
(Author)

Evgenii Troinov
(maintainer)

About

A Jest transformer using esbuild

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 80.9%
  • JavaScript 19.1%
0