With this transformer you can use and transform (ts, js, tsx and jsx) files
npm install --save-dev @lgse/esbuild-jest esbuild
esbuild-jest transformer should be used in your Jest config file like this:
{
"transform": {
"^.+\\.tsx?$": "@lgse/esbuild-jest"
}
}
export interface Options {
jsxFactory?: string
jsxFragment?: string
sourcemap?: boolean | 'inline' | 'external'
loaders?: {
[ext: string]: Loader
},
target?: string
format?: string
define?: { [key: string]: string }
}
{
"transform": {
"^.+\\.tsx?$": [
"@lgse/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