Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

es-jest

ambar25.1kMIT2.1.0

esbuild preprocessor for Jest

jest, esbuild, testing

readme

es-jest

ESM/React/TypeScript preprocessor for Jest, powered by esbuild.

build status npm version

Install

npm install es-jest --save-dev

Usage

Add preset to Jest config:

{
  "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:

import path from 'path'

test('parses extname', () => {
  expect(path.extname('foo.md')).toBe('.md')
})

Happy testing!

changelog

Changelog

All notable changes to this project will be documented in this file. See standard-version for commit guidelines.

2.1.0 (2022-10-25)

Features

  • add support for transformer config (#4) (a3f7e56)

2.0.0 (2022-06-13)

⚠ BREAKING CHANGES

  • support Jest 28

Features

1.5.0 (2021-11-19)

Features

  • add mjs/cjs to default extensions (dce8a8e)

1.4.0 (2021-10-13)

Features

  • change version range of esbuild, match all 0.x versions (9703110)

1.3.0 (2021-08-18)

Features

  • update esbuild to v0.12.20 (83bdb57)

1.2.0 (2021-03-15)

Features

1.1.0 (2021-01-24)

Features