es-jest

esbuild preprocessor for Jest

MIT 9 个版本
安装
npm install es-jest
yarn add es-jest
pnpm add es-jest
bun add es-jest
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!

版本列表
2.1.0 2022-10-25
2.0.0 2022-06-13
1.5.0 2021-11-19
1.4.1 2021-10-13
1.4.0 2021-10-13
1.3.0 2021-08-18
1.2.0 2021-03-15
1.1.0 2021-01-24
0.0.1 2020-12-04