Jest plugin to use esbuild for transformation
npm install esbuild-jest2This 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:
- esjest-transform;
- jest-esbuild;
- esbuild-runner;
- esbuild-jest-transform;
Also:
- support jest v29+;
``bash`
npm install --save-dev esbuild-jest2 esbuild
esbuild-jest transformer should be used in your Jest config file like this:
`js`
{
"transform": {
"^.+\\.tsx?$": "esbuild-jest2"
}
}
#### Setting up Jest config file with transformOptions
`typescript`
export interface Options {
jsxFactory?: string
jsxFragment?: string
sourcemap?: boolean | 'inline' | 'external'
loaders?: {
[ext: string]: Loader
},
target?: string
format?: string
}
`js`
{
"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
width="150" /> Jay Aelbore (Author) | width="150" /> Evgenii Troinov (maintainer) |