Skip to content

Commit 199cc70

Browse files
btkostnernovemberborn
authored andcommitted
Update TypeScript recipe for new extensions support
1 parent 09f2d87 commit 199cc70

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

docs/recipes/typescript.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,28 @@ AVA comes bundled with a TypeScript definition file. This allows developers to l
66

77
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.
88

9+
## Configuring AVA to compile TypeScript files on the fly
10+
11+
You can configure AVA to recognize TypeScript files. Then, with `ts-node` installed, you can compile them on the fly:
12+
13+
```json
14+
{
15+
"ava": {
16+
"compileEnhancements": false,
17+
"extensions": [
18+
"ts"
19+
],
20+
"require": [
21+
"ts-node/register"
22+
]
23+
}
24+
}
25+
```
26+
27+
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`.
28+
29+
## Compiling TypeScript files before running AVA
30+
931
Add a `test` script in the `package.json` file. It will compile the project first and then run AVA.
1032

1133
```json

0 commit comments

Comments
 (0)