Skip to content
Search

Babel-jest

lastmod 2022-04-08created 2022-04-083 edits

What is this?

To pass typescript code directly to ts-jest, the following setting is needed in the jest.config.js file:

module.exports = {
  "testMatch": [
    "**/__tests__/**/*.+(ts|tsx|js)",
    "**/?(*.)+(spec|test).+(ts|tsx|js)"
  ],
  "transform": {
    "^.+\\.(ts|tsx)$": "ts-jest"
  },
}

You can think of it as doing the job of the transform part there.

The setting shown on the site is as follows:

"transform": {
  "\\.[jt]sx?$": "babel-jest"
},

See also

Favorite site

author Zer0 sitemap