Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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: 3 months 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 (about 4 years ago)
- Default Branch: main
- Last Pushed: 2022-10-25T03:03:14.000Z (over 2 years ago)
- Last Synced: 2024-09-16T11:55:24.199Z (5 months ago)
- Topics: esbuild, esm, jest, testing, typescript
- Language: JavaScript
- Homepage:
- Size: 254 KB
- Stars: 20
- Watchers: 3
- 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).
[![build status](https://badgen.net/travis/ambar/es-jest)](https://travis-ci.org/ambar/es-jest)
[![npm version](https://badgen.net/npm/v/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)