Skip to content

Commit b7aee62

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

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

docs/rules/prefer-expect-assertions.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,3 +69,27 @@ 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 warning:
74+
75+
```js
76+
test('my test', async () => {
77+
const result = await someAsyncFunc();
78+
expect(result).toBe('foo');
79+
});
80+
```
81+
82+
While the following patterns would not be considered warnings:
83+
84+
```js
85+
test('my test', () => {
86+
const result = someFunction();
87+
expect(result).toBe('foo');
88+
});
89+
90+
test('my test', async () => {
91+
expect.assertions(1);
92+
const result = await someAsyncFunc();
93+
expect(result).toBe('foo');
94+
});
95+
```

0 commit comments

Comments
 (0)