0.6.1 • Published 3 years ago
@pastak/esbuild-jest v0.6.1
esbuild-jest
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-jest esbuildSetting 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
  sourcemap?: boolean | 'inline' | 'external'
  loaders?: {
    [ext: string]: Loader
  },
  target?: string
  format?: string
}{
  "transform": {
    "^.+\\.tsx?$": [ 
      "esbuild-jest", 
      { 
        sourcemap: true,
        loaders: {
          '.spec.ts': 'tsx'
        }
      } 
    ]
  }
}Note: if you are using tsconfig.json and jsconfig.json with "paths", Please look
alias-hqand there documentation https://github.com/davestewart/alias-hq/blob/master/docs/integrations.md