https://github.com/ambar/es-jest
ESM/React/TypeScript preprocessor for Jest, powered by esbuild.
https://github.com/ambar/es-jest
esbuild esm jest testing typescript
Last synced: about 1 month ago
JSON representation
ESM/React/TypeScript preprocessor for Jest, powered by esbuild.
- Host: GitHub
- URL: https://github.com/ambar/es-jest
- Owner: ambar
- License: mit
- Created: 2020-12-04T16:52:08.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2022-10-25T03:03:14.000Z (over 2 years ago)
- Last Synced: 2025-04-23T05:57:51.197Z (about 1 month ago)
- Topics: esbuild, esm, jest, testing, typescript
- Language: JavaScript
- Homepage:
- Size: 254 KB
- Stars: 20
- Watchers: 2
- Forks: 5
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# es-jest
ESM/React/TypeScript preprocessor for Jest, powered by [esbuild](https://github.com/evanw/esbuild).
[](https://travis-ci.org/ambar/es-jest)
[](https://www.npmjs.com/package/es-jest)## Install
```bash
npm install es-jest --save-dev
```## Usage
Add preset to Jest config:
```json
{
"jest": {
"preset": "es-jest"
}
}// alternatively, specifying the files to transform:
{
"jest": {
"transform": {
"\\.[jt]sx?$": "es-jest"
},
}
}// you can also provide a custom esbuild config:
{
"jest": {
"transform": {
"\\.[jt]sx?$": ["es-jest", { "jsx": "automatic" }]
},
}
}
```Write your tests with ES modules:
```js
import path from 'path'test('parses extname', () => {
expect(path.extname('foo.md')).toBe('.md')
})
```Happy testing!
## Related
- [rollup-jest](https://github.com/ambar/rollup-jest)
- [babel-jest](https://github.com/facebook/jest/tree/master/packages/babel-jest)
- [ts-jest](https://github.com/kulshekhar/ts-jest)