Skip to content

Commit 49b8185

Browse files
authored
Update prefer-t-throws.md
1 parent 05a9635 commit 49b8185

File tree

1 file changed

+1
-16
lines changed

1 file changed

+1
-16
lines changed

docs/rules/prefer-t-throws.md

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -51,22 +51,7 @@ test('some test', async t => {
5151
const test = require('ava');
5252

5353
test('some test', async t => {
54-
const error = await t.throwsAsync(asyncThrowingFunction());
55-
t.is(error.message, 'Unicorn overload');
56-
});
57-
```
58-
59-
```js
60-
const test = require('ava');
61-
62-
test('some test', async t => {
63-
try {
64-
const result = await potentiallyThrowingFunction();
65-
// This passes because using a try-catch can be intentional, for example, to test both the result and the error:
66-
// t.is(result, 'Unicorn success');
67-
} catch (error) {
68-
t.is(error.message, 'Unicorn overload');
69-
}
54+
await t.throwsAsync(asyncThrowingFunction(), {message: 'Unicorn overload'});
7055
});
7156
```
7257

0 commit comments

Comments
 (0)