es-jest

2.1.0 • Public • Published

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!

Related

Readme

Keywords

Package Sidebar

Install

npm i es-jest

Weekly Downloads

1,356

Version

2.1.0

License

MIT

Unpacked Size

3.85 kB

Total Files

5

Last publish

Collaborators

  • ambarli