Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/aelbore/esbuild-jest
A Jest transformer using esbuild
https://github.com/aelbore/esbuild-jest
esbuild javascript jest test transformer typescript
Last synced: 4 days ago
JSON representation
A Jest transformer using esbuild
- Host: GitHub
- URL: https://github.com/aelbore/esbuild-jest
- Owner: aelbore
- Created: 2020-05-23T05:25:16.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-07-23T10:29:07.000Z (6 months ago)
- Last Synced: 2025-01-02T02:02:52.881Z (11 days ago)
- Topics: esbuild, javascript, jest, test, transformer, typescript
- Language: TypeScript
- Homepage:
- Size: 873 KB
- Stars: 519
- Watchers: 7
- Forks: 51
- Open Issues: 63
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-pinoy-made - GitHub
README
# esbuild-jest
### A Jest transformer using esbuild
With this transformer you can use and transform (ts, js, tsx and jsx) files[![npm](https://img.shields.io/npm/v/esbuild-jest.svg)](https://www.npmjs.com/package/esbuild-jest)
![build status](https://github.com/aelbore/esbuild-jest/actions/workflows/ci.yml/badge.svg)## Install
```bash
npm install --save-dev esbuild-jest esbuild
```#### Setting up Jest config file
esbuild-jest transformer should be used in your Jest config file like this:
```js
{
"transform": {
"^.+\\.tsx?$": "esbuild-jest"
}
}
```#### 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-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