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

Add this.extend to the Custom Matchers API reference #7130

Merged
merged 3 commits into from
Oct 9, 2018
Merged
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@

### Chore & Maintenance

- `[docs]` Add `this.extend` to the Custom Matchers API reference ([#7130](https://github.com/facebook/jest/pull/7130))
- `[docs]` Fix default value for `coverageReporters` value in configuration docs ([#7126](https://github.com/facebook/jest/pull/7126))
- `[docs]` Add link for jest-extended in expect docs ([#7078](https://github.com/facebook/jest/pull/7078))
- `[jest-util]` Add ErrorWithStack class ([#7067](https://github.com/facebook/jest/pull/7067))
Expand Down
6 changes: 5 additions & 1 deletion docs/ExpectAPI.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ expect.extend({
});
```

These helper functions can be found on `this` inside a custom matcher:
These helper functions and properties can be found on `this` inside a custom matcher:

#### `this.isNot`

Expand All @@ -123,6 +123,10 @@ A boolean to let you know this matcher was called with the negated `.not` modifi

This is a deep-equality function that will return `true` if two objects have the same values (recursively).

#### `this.expand`

A boolean to let you know this matcher was called with an `expand` option. When Jest is called with the `--expand` flag, `this.expand` can be used to determine if Jest is expected to show full diffs and errors.

#### `this.utils`

There are a number of helpful tools exposed on `this.utils` primarily consisting of the exports from [`jest-matcher-utils`](https://github.com/facebook/jest/tree/master/packages/jest-matcher-utils).
Expand Down
6 changes: 5 additions & 1 deletion website/versioned_docs/version-22.0/ExpectAPI.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ test('even and odd numbers', () => {

Matchers should return an object with two keys. `pass` indicates whether there was a match or not, and `message` provides a function with no arguments that returns an error message in case of failure. Thus, when `pass` is false, `message` should return the error message for when `expect(x).yourMatcher()` fails. And when `pass` is true, `message` should return the error message for when `expect(x).not.yourMatcher()` fails.

These helper functions can be found on `this` inside a custom matcher:
These helper functions and properties can be found on `this` inside a custom matcher:

#### `this.isNot`

Expand All @@ -73,6 +73,10 @@ A boolean to let you know this matcher was called with the negated `.not` modifi

This is a deep-equality function that will return `true` if two objects have the same values (recursively).

#### `this.expand`

A boolean to let you know this matcher was called with an `expand` option. When Jest is called with the `--expand` flag, `this.expand` can be used to determine if Jest is expected to show full diffs and errors.

#### `this.utils`

There are a number of helpful tools exposed on `this.utils` primarily consisting of the exports from [`jest-matcher-utils`](https://github.com/facebook/jest/tree/master/packages/jest-matcher-utils).
Expand Down
6 changes: 5 additions & 1 deletion website/versioned_docs/version-22.1/ExpectAPI.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ test('even and odd numbers', () => {

Matchers should return an object with two keys. `pass` indicates whether there was a match or not, and `message` provides a function with no arguments that returns an error message in case of failure. Thus, when `pass` is false, `message` should return the error message for when `expect(x).yourMatcher()` fails. And when `pass` is true, `message` should return the error message for when `expect(x).not.yourMatcher()` fails.

These helper functions can be found on `this` inside a custom matcher:
These helper functions and properties can be found on `this` inside a custom matcher:

#### `this.isNot`

Expand All @@ -73,6 +73,10 @@ A boolean to let you know this matcher was called with the negated `.not` modifi

This is a deep-equality function that will return `true` if two objects have the same values (recursively).

#### `this.expand`

A boolean to let you know this matcher was called with an `expand` option. When Jest is called with the `--expand` flag, `this.expand` can be used to determine if Jest is expected to show full diffs and errors.

#### `this.utils`

There are a number of helpful tools exposed on `this.utils` primarily consisting of the exports from [`jest-matcher-utils`](https://github.com/facebook/jest/tree/master/packages/jest-matcher-utils).
Expand Down
6 changes: 5 additions & 1 deletion website/versioned_docs/version-22.2/ExpectAPI.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ test('even and odd numbers', () => {

Matchers should return an object with two keys. `pass` indicates whether there was a match or not, and `message` provides a function with no arguments that returns an error message in case of failure. Thus, when `pass` is false, `message` should return the error message for when `expect(x).yourMatcher()` fails. And when `pass` is true, `message` should return the error message for when `expect(x).not.yourMatcher()` fails.

These helper functions can be found on `this` inside a custom matcher:
These helper functions and properties can be found on `this` inside a custom matcher:

#### `this.isNot`

Expand All @@ -73,6 +73,10 @@ A boolean to let you know this matcher was called with the negated `.not` modifi

This is a deep-equality function that will return `true` if two objects have the same values (recursively).

#### `this.expand`

A boolean to let you know this matcher was called with an `expand` option. When Jest is called with the `--expand` flag, `this.expand` can be used to determine if Jest is expected to show full diffs and errors.

#### `this.utils`

There are a number of helpful tools exposed on `this.utils` primarily consisting of the exports from [`jest-matcher-utils`](https://github.com/facebook/jest/tree/master/packages/jest-matcher-utils).
Expand Down
6 changes: 5 additions & 1 deletion website/versioned_docs/version-22.3/ExpectAPI.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ test('even and odd numbers', () => {

Matchers should return an object with two keys. `pass` indicates whether there was a match or not, and `message` provides a function with no arguments that returns an error message in case of failure. Thus, when `pass` is false, `message` should return the error message for when `expect(x).yourMatcher()` fails. And when `pass` is true, `message` should return the error message for when `expect(x).not.yourMatcher()` fails.

These helper functions can be found on `this` inside a custom matcher:
These helper functions and properties can be found on `this` inside a custom matcher:

#### `this.isNot`

Expand All @@ -73,6 +73,10 @@ A boolean to let you know this matcher was called with the negated `.not` modifi

This is a deep-equality function that will return `true` if two objects have the same values (recursively).

#### `this.expand`

A boolean to let you know this matcher was called with an `expand` option. When Jest is called with the `--expand` flag, `this.expand` can be used to determine if Jest is expected to show full diffs and errors.

#### `this.utils`

There are a number of helpful tools exposed on `this.utils` primarily consisting of the exports from [`jest-matcher-utils`](https://github.com/facebook/jest/tree/master/packages/jest-matcher-utils).
Expand Down
6 changes: 5 additions & 1 deletion website/versioned_docs/version-23.0/ExpectAPI.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ test('is divisible by external value', async () => {

Matchers should return an object (or a Promise of an object) with two keys. `pass` indicates whether there was a match or not, and `message` provides a function with no arguments that returns an error message in case of failure. Thus, when `pass` is false, `message` should return the error message for when `expect(x).yourMatcher()` fails. And when `pass` is true, `message` should return the error message for when `expect(x).not.yourMatcher()` fails.

These helper functions can be found on `this` inside a custom matcher:
These helper functions and properties can be found on `this` inside a custom matcher:

#### `this.isNot`

Expand All @@ -106,6 +106,10 @@ A boolean to let you know this matcher was called with the negated `.not` modifi

This is a deep-equality function that will return `true` if two objects have the same values (recursively).

#### `this.expand`

A boolean to let you know this matcher was called with an `expand` option. When Jest is called with the `--expand` flag, `this.expand` can be used to determine if Jest is expected to show full diffs and errors.

#### `this.utils`

There are a number of helpful tools exposed on `this.utils` primarily consisting of the exports from [`jest-matcher-utils`](https://github.com/facebook/jest/tree/master/packages/jest-matcher-utils).
Expand Down
6 changes: 5 additions & 1 deletion website/versioned_docs/version-23.1/ExpectAPI.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ test('is divisible by external value', async () => {

Matchers should return an object (or a Promise of an object) with two keys. `pass` indicates whether there was a match or not, and `message` provides a function with no arguments that returns an error message in case of failure. Thus, when `pass` is false, `message` should return the error message for when `expect(x).yourMatcher()` fails. And when `pass` is true, `message` should return the error message for when `expect(x).not.yourMatcher()` fails.

These helper functions can be found on `this` inside a custom matcher:
These helper functions and properties can be found on `this` inside a custom matcher:

#### `this.isNot`

Expand All @@ -106,6 +106,10 @@ A boolean to let you know this matcher was called with the negated `.not` modifi

This is a deep-equality function that will return `true` if two objects have the same values (recursively).

#### `this.expand`

A boolean to let you know this matcher was called with an `expand` option. When Jest is called with the `--expand` flag, `this.expand` can be used to determine if Jest is expected to show full diffs and errors.

#### `this.utils`

There are a number of helpful tools exposed on `this.utils` primarily consisting of the exports from [`jest-matcher-utils`](https://github.com/facebook/jest/tree/master/packages/jest-matcher-utils).
Expand Down
6 changes: 5 additions & 1 deletion website/versioned_docs/version-23.2/ExpectAPI.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ test('is divisible by external value', async () => {

Matchers should return an object (or a Promise of an object) with two keys. `pass` indicates whether there was a match or not, and `message` provides a function with no arguments that returns an error message in case of failure. Thus, when `pass` is false, `message` should return the error message for when `expect(x).yourMatcher()` fails. And when `pass` is true, `message` should return the error message for when `expect(x).not.yourMatcher()` fails.

These helper functions can be found on `this` inside a custom matcher:
These helper functions and properties can be found on `this` inside a custom matcher:

#### `this.isNot`

Expand All @@ -106,6 +106,10 @@ A boolean to let you know this matcher was called with the negated `.not` modifi

This is a deep-equality function that will return `true` if two objects have the same values (recursively).

#### `this.expand`

A boolean to let you know this matcher was called with an `expand` option. When Jest is called with the `--expand` flag, `this.expand` can be used to determine if Jest is expected to show full diffs and errors.

#### `this.utils`

There are a number of helpful tools exposed on `this.utils` primarily consisting of the exports from [`jest-matcher-utils`](https://github.com/facebook/jest/tree/master/packages/jest-matcher-utils).
Expand Down
6 changes: 5 additions & 1 deletion website/versioned_docs/version-23.3/ExpectAPI.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ test('is divisible by external value', async () => {

Matchers should return an object (or a Promise of an object) with two keys. `pass` indicates whether there was a match or not, and `message` provides a function with no arguments that returns an error message in case of failure. Thus, when `pass` is false, `message` should return the error message for when `expect(x).yourMatcher()` fails. And when `pass` is true, `message` should return the error message for when `expect(x).not.yourMatcher()` fails.

These helper functions can be found on `this` inside a custom matcher:
These helper functions and properties can be found on `this` inside a custom matcher:

#### `this.isNot`

Expand All @@ -106,6 +106,10 @@ A boolean to let you know this matcher was called with the negated `.not` modifi

This is a deep-equality function that will return `true` if two objects have the same values (recursively).

#### `this.expand`

A boolean to let you know this matcher was called with an `expand` option. When Jest is called with the `--expand` flag, `this.expand` can be used to determine if Jest is expected to show full diffs and errors.

#### `this.utils`

There are a number of helpful tools exposed on `this.utils` primarily consisting of the exports from [`jest-matcher-utils`](https://github.com/facebook/jest/tree/master/packages/jest-matcher-utils).
Expand Down
6 changes: 5 additions & 1 deletion website/versioned_docs/version-23.4/ExpectAPI.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ test('is divisible by external value', async () => {

Matchers should return an object (or a Promise of an object) with two keys. `pass` indicates whether there was a match or not, and `message` provides a function with no arguments that returns an error message in case of failure. Thus, when `pass` is false, `message` should return the error message for when `expect(x).yourMatcher()` fails. And when `pass` is true, `message` should return the error message for when `expect(x).not.yourMatcher()` fails.

These helper functions can be found on `this` inside a custom matcher:
These helper functions and properties can be found on `this` inside a custom matcher:

#### `this.isNot`

Expand All @@ -106,6 +106,10 @@ A boolean to let you know this matcher was called with the negated `.not` modifi

This is a deep-equality function that will return `true` if two objects have the same values (recursively).

#### `this.expand`

A boolean to let you know this matcher was called with an `expand` option. When Jest is called with the `--expand` flag, `this.expand` can be used to determine if Jest is expected to show full diffs and errors.

#### `this.utils`

There are a number of helpful tools exposed on `this.utils` primarily consisting of the exports from [`jest-matcher-utils`](https://github.com/facebook/jest/tree/master/packages/jest-matcher-utils).
Expand Down
6 changes: 5 additions & 1 deletion website/versioned_docs/version-23.5/ExpectAPI.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ test('is divisible by external value', async () => {

Matchers should return an object (or a Promise of an object) with two keys. `pass` indicates whether there was a match or not, and `message` provides a function with no arguments that returns an error message in case of failure. Thus, when `pass` is false, `message` should return the error message for when `expect(x).yourMatcher()` fails. And when `pass` is true, `message` should return the error message for when `expect(x).not.yourMatcher()` fails.

These helper functions can be found on `this` inside a custom matcher:
These helper functions and properties can be found on `this` inside a custom matcher:

#### `this.isNot`

Expand All @@ -106,6 +106,10 @@ A boolean to let you know this matcher was called with the negated `.not` modifi

This is a deep-equality function that will return `true` if two objects have the same values (recursively).

#### `this.expand`

A boolean to let you know this matcher was called with an `expand` option. When Jest is called with the `--expand` flag, `this.expand` can be used to determine if Jest is expected to show full diffs and errors.

#### `this.utils`

There are a number of helpful tools exposed on `this.utils` primarily consisting of the exports from [`jest-matcher-utils`](https://github.com/facebook/jest/tree/master/packages/jest-matcher-utils).
Expand Down
6 changes: 5 additions & 1 deletion website/versioned_docs/version-23.6/ExpectAPI.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ expect.extend({
});
```

These helper functions can be found on `this` inside a custom matcher:
These helper functions and properties can be found on `this` inside a custom matcher:

#### `this.isNot`

Expand All @@ -124,6 +124,10 @@ A boolean to let you know this matcher was called with the negated `.not` modifi

This is a deep-equality function that will return `true` if two objects have the same values (recursively).

#### `this.expand`

A boolean to let you know this matcher was called with an `expand` option. When Jest is called with the `--expand` flag, `this.expand` can be used to determine if Jest is expected to show full diffs and errors.

#### `this.utils`

There are a number of helpful tools exposed on `this.utils` primarily consisting of the exports from [`jest-matcher-utils`](https://github.com/facebook/jest/tree/master/packages/jest-matcher-utils).
Expand Down