Skip to content

Commit

Permalink
Add link to the typesript integration instructions
Browse files Browse the repository at this point in the history
I installed jest and typescript, but they refused to integrate. jest was throwing SyntaxErrors at me when parsing typescript files. Searching for typescript on you website got me here https://jestjs.io/blog/2019/01/25/jest-24-refreshing-polished-typescript-friendly#typescript-support which a very unhelpful because it does not contain instructions on how to configure the integration. It turned out that I need babel.config.js
  • Loading branch information
hexagonrecursion committed Sep 2, 2021
1 parent 98f10e6 commit 16ab528
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ The aim of the redesign was to highlight more of what makes Jest awesome, and to

## TypeScript support

See [this instructions](https://jestjs.io/docs/getting-started#using-typescript) to enable TypeScript support.

We've upgraded to Babel 7 internally for Jest 24, which comes with support for TypeScript projects. That means Jest can support transpiling TypeScript out of the box, as long as you configure Babel to use it with `@babel/preset-typescript`. One caveat to the default TypeScript support, similar to Flow, is that Babel will only strip out the type annotations to make your code valid JavaScript. It will _not_ typecheck your code.

While Jest has supported Babel 7 since version 22 released in December 2017, it required usage of a bridge module in order to fit in with Jest's support of Babel 6. In Jest 24 we have migrated entirely over to Babel 7, with great help from community member [@milesj](https://github.com/milesj). This means that setup is now easier and we can take advantage of other Babel 7 features, such as config loading and automatic `modules` transpilation. Make sure to remove the `babel-core@^7.0.0-bridge.0` as it's not needed now.
Expand Down

0 comments on commit 16ab528

Please sign in to comment.