Permalink
Browse files

Update TypeScript recipe for new extensions support

  • Loading branch information...
btkostner authored and novemberborn committed Jun 13, 2018
1 parent 09f2d87 commit 199cc70f20c79755595872274b2fb4a8e6509377
Showing with 22 additions and 0 deletions.
  1. +22 −0 docs/recipes/typescript.md
@@ -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

0 comments on commit 199cc70

Please sign in to comment.