Skip to content

Commit

Permalink
fix toContain suggest to contain equal message
Browse files Browse the repository at this point in the history
  • Loading branch information
Gregory Assasie committed Aug 8, 2018
1 parent 277c547 commit 2afbf5b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
- `[jest-jasmine2]` Use prettier through `require` instead of `localRequire`. Fixes `matchInlineSnapshot` where prettier dependencies like `path` and `fs` are mocked with `jest.mock`. ([#6776](https://github.com/facebook/jest/pull/6776))
- `[docs]` Fix contributors link ([#6711](https://github.com/facebook/jest/pull/6711))
- `[website]` Fix website versions page to link to correct language ([#6734](https://github.com/facebook/jest/pull/6734))
- `[expect]` Update `toContain` suggestion to contain equal message ([#6792](https://github.com/facebook/jest/pull/6810))

## 23.4.1

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1517,7 +1517,9 @@ exports[`.toContain(), .toContainEqual() '[{}, []]' does not contain '[]' 1`] =
Expected array:
<red>[{}, []]</>
To contain value:
<green>[]</> <dim>Looks like you wanted to test for object/array equality with the stricter \`toContain\` matcher. You probably need to use \`toContainEqual\` instead.</>"
<green>[]</>

<dim>Looks like you wanted to test for object/array equality with the stricter \`toContain\` matcher. You probably need to use \`toContainEqual\` instead.</>"
`;

exports[`.toContain(), .toContainEqual() '[{}, []]' does not contain '{}' 1`] = `
Expand All @@ -1526,7 +1528,9 @@ exports[`.toContain(), .toContainEqual() '[{}, []]' does not contain '{}' 1`] =
Expected array:
<red>[{}, []]</>
To contain value:
<green>{}</> <dim>Looks like you wanted to test for object/array equality with the stricter \`toContain\` matcher. You probably need to use \`toContainEqual\` instead.</>"
<green>{}</>

<dim>Looks like you wanted to test for object/array equality with the stricter \`toContain\` matcher. You probably need to use \`toContainEqual\` instead.</>"
`;

exports[`.toContain(), .toContainEqual() '[0, 1]' contains '1' 1`] = `
Expand Down
2 changes: 1 addition & 1 deletion packages/expect/src/matchers.js
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ const matchers: MatchersObject = {
` ${printReceived(collection)}\n` +
`To contain value:\n` +
` ${printExpected(value)}` +
(suggestToContainEqual ? ` ${SUGGEST_TO_CONTAIN_EQUAL}` : '')
(suggestToContainEqual ? `\n\n${SUGGEST_TO_CONTAIN_EQUAL}` : '')
);
};

Expand Down

0 comments on commit 2afbf5b

Please sign in to comment.