Skip to content

Commit 3e94e51

Browse files
author
Mario Campa
committed
feat(prefer-expect-assertions): adding documetation examples
1 parent fde9db1 commit 3e94e51

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

docs/rules/prefer-expect-assertions.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,3 +69,28 @@ When `true`, this rule will only warn for tests that use the `async` keyword.
6969
}
7070
}
7171
```
72+
73+
When `asyncOnly` option is set to `true`, the following pattern would be a
74+
warning:
75+
76+
```js
77+
test('my test', async () => {
78+
const result = await someAsyncFunc();
79+
expect(result).toBe('foo');
80+
});
81+
```
82+
83+
While the following patterns would not be considered warnings:
84+
85+
```js
86+
test('my test', () => {
87+
const result = someFunction();
88+
expect(result).toBe('foo');
89+
});
90+
91+
test('my test', async () => {
92+
expect.assertions(1);
93+
const result = await someAsyncFunc();
94+
expect(result).toBe('foo');
95+
});
96+
```

0 commit comments

Comments
 (0)