@schickling-tmp/esbuild-jest

Jest plugin to use esbuild for transformation

Usage no npm install needed!

<script type="module">
  import schicklingTmpEsbuildJest from 'https://cdn.skypack.dev/@schickling-tmp/esbuild-jest';
</script>

README

esbuild-jest

A Jest transformer using esbuild

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

npm build status

Install

npm install --save-dev esbuild-jest esbuild

Setting up Jest config file

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

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

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
  instrument?: boolean
}
{
  "transform": {
    "^.+\\.tsx?quot;: [ 
      "esbuild-jest", 
      { 
        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