Skip to content

Commit

Permalink
Add docs
Browse files Browse the repository at this point in the history
  • Loading branch information
ealush committed Sep 24, 2023
1 parent 21c11ab commit 54e8585
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions website/docs/writing_tests/async_tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,21 @@ test('name', 'Already Taken', async () => {
return await doesUserExist(user);
});
```

## Using AbortSignal

> Since 5.1.0
Each Vest test is passed as an argument an `AbortSignal` object. Vest internally sets the AbortSignal `aborted` property to true when the test is canceled.

A test is canceled when running the same test again before its previous run has completed.

You can use the AbortSignal to stop the execution of your async test, or pass it to your fetch request.

[Read more on AbortSignal](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal).

```js
test('name', 'Already Taken', async signal => {
// ...
});
```

0 comments on commit 54e8585

Please sign in to comment.