You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/recipes/typescript.md
+22Lines changed: 22 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,6 +6,28 @@ AVA comes bundled with a TypeScript definition file. This allows developers to l
6
6
7
7
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.
8
8
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
+
9
31
Add a `test` script in the `package.json` file. It will compile the project first and then run AVA.
0 commit comments