Skip to content

Commit

Permalink
feat(prefer-expect-assertions): adding documetation examples
Browse files Browse the repository at this point in the history
  • Loading branch information
Mario Campa committed Sep 29, 2020
1 parent fde9db1 commit 3e94e51
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions docs/rules/prefer-expect-assertions.md
Expand Up @@ -69,3 +69,28 @@ When `true`, this rule will only warn for tests that use the `async` keyword.
}
}
```

When `asyncOnly` option is set to `true`, the following pattern would be a
warning:

```js
test('my test', async () => {
const result = await someAsyncFunc();
expect(result).toBe('foo');
});
```

While the following patterns would not be considered warnings:

```js
test('my test', () => {
const result = someFunction();
expect(result).toBe('foo');
});

test('my test', async () => {
expect.assertions(1);
const result = await someAsyncFunc();
expect(result).toBe('foo');
});
```

0 comments on commit 3e94e51

Please sign in to comment.