Skip to content

ambar/es-jest

Repository files navigation

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

About

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

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •