We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 05a9635 commit 49b8185Copy full SHA for 49b8185
docs/rules/prefer-t-throws.md
@@ -51,22 +51,7 @@ test('some test', async t => {
51
const test = require('ava');
52
53
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
69
- }
+ await t.throwsAsync(asyncThrowingFunction(), {message: 'Unicorn overload'});
70
});
71
```
72
0 commit comments