ESM/React/TypeScript preprocessor for Jest, powered by esbuild.
npm install es-jest --save-dev
Add preset to Jest config:
{
"jest": {
"preset": "es-jest"
}
}
// alternatively, specifying the files to transform:
{
"jest": {
"transform": {
"\\.[jt]sx?$": "es-jest"
},
}
}
Writes your test with ES modules:
import path from 'path'
test('parses extname', () => {
expect(path.extname('foo.md')).toBe('.md')
})
Happy testing!