Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct erroneous rejects test example #6421

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions docs/ExpectAPI.md
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,8 @@ For example, this code tests that the promise rejects with reason `'octopus'`:
```js
test('rejects to octopus', () => {
// make sure to add a return statement
return expect(Promise.reject(new Error('octopus'))).rejects.toThrow(
return expect(Promise.reject(new Error('octopus'))).rejects.toHaveProperty(
'message',
'octopus',
);
});
Expand All @@ -458,7 +459,10 @@ Alternatively, you can use `async/await` in combination with `.rejects`.

```js
test('rejects to octopus', async () => {
await expect(Promise.reject(new Error('octopus'))).rejects.toThrow('octopus');
await expect(Promise.reject(new Error('octopus'))).rejects.toHaveProperty(
'message',
'octopus',
);
});
```

Expand Down
2 changes: 1 addition & 1 deletion website/versioned_docs/version-23.0/WatchPlugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class MyWatchPlugin {
## Hooking into Jest

To connect your watch plugin to Jest, add its path under `watchPlugins` in your Jest configuration:

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is from prettier 🤷‍♂️

```javascript
// jest.config.js
module.exports = {
Expand Down