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 b7aee62
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions docs/rules/prefer-expect-assertions.md
Expand Up @@ -69,3 +69,27 @@ 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 b7aee62

Please sign in to comment.