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
AVA comes bundled with a TypeScript definition file. This allows developers to leverage TypeScript for writing tests.
6
6
7
+
7
8
## Setup
8
9
9
10
First install [TypeScript](https://github.com/Microsoft/TypeScript) (if you already have it installed, make sure you use version 2.1 or greater).
@@ -12,7 +13,7 @@ First install [TypeScript](https://github.com/Microsoft/TypeScript) (if you alre
12
13
$ npm install --save-dev typescript
13
14
```
14
15
15
-
Create a [`tsconfig.json`](https://github.com/Microsoft/TypeScript/wiki/tsconfig.json) file. This file specifies the compiler options required to compile the project or the test file.
16
+
Create a [`tsconfig.json`](http://www.typescriptlang.org/docs/handbook/tsconfig-json.html) file. This file specifies the compiler options required to compile the project or the test file.
16
17
17
18
```json
18
19
{
@@ -49,6 +50,7 @@ test(async (t) => {
49
50
});
50
51
```
51
52
53
+
52
54
## Working with [`context`](https://github.com/avajs/ava#test-context)
53
55
54
56
By default, the type of `t.context` will be [`any`](https://www.typescriptlang.org/docs/handbook/basic-types.html#any). AVA exposes an interface `RegisterContextual<T>` which you can use to apply your own type to `t.context`. This can help you catch errors at compile-time:
0 commit comments