Skip to content

Commit

Permalink
Update TypeScript recipe for new extensions support
Browse files Browse the repository at this point in the history
  • Loading branch information
btkostner authored and novemberborn committed Jun 13, 2018
1 parent 09f2d87 commit 199cc70
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions docs/recipes/typescript.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,28 @@ AVA comes bundled with a TypeScript definition file. This allows developers to l

This guide assumes you've already set up TypeScript for your project. Note that AVA's definition has been tested with version 2.8.3.

## Configuring AVA to compile TypeScript files on the fly

You can configure AVA to recognize TypeScript files. Then, with `ts-node` installed, you can compile them on the fly:

```json
{
"ava": {
"compileEnhancements": false,
"extensions": [
"ts"
],
"require": [
"ts-node/register"
]
}
}
```

It's worth noting that with this configuration tests will fail if there are TypeScript build errors. If you want to test while ignoring these errors you can use `ts-node/register/transpile-only` instead of `ts-node/register`.

## Compiling TypeScript files before running AVA

Add a `test` script in the `package.json` file. It will compile the project first and then run AVA.

```json
Expand Down

0 comments on commit 199cc70

Please sign in to comment.