Skip to content

Commit 9f07036

Browse files
Gregjarvezthymikee
authored andcommitted
fix toContain suggest to contain equal message (#6810)
1 parent 0a16c5d commit 9f07036

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
- `[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))
2626
- `[docs]` Fix contributors link ([#6711](https://github.com/facebook/jest/pull/6711))
2727
- `[website]` Fix website versions page to link to correct language ([#6734](https://github.com/facebook/jest/pull/6734))
28+
- `[expect]` Update `toContain` suggestion to contain equal message ([#6792](https://github.com/facebook/jest/pull/6810))
2829

2930
## 23.4.1
3031

packages/expect/src/__tests__/__snapshots__/matchers.test.js.snap

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1517,7 +1517,9 @@ exports[`.toContain(), .toContainEqual() '[{}, []]' does not contain '[]' 1`] =
15171517
Expected array:
15181518
<red>[{}, []]</>
15191519
To contain value:
1520-
<green>[]</> <dim>Looks like you wanted to test for object/array equality with the stricter \`toContain\` matcher. You probably need to use \`toContainEqual\` instead.</>"
1520+
<green>[]</>
1521+
1522+
<dim>Looks like you wanted to test for object/array equality with the stricter \`toContain\` matcher. You probably need to use \`toContainEqual\` instead.</>"
15211523
`;
15221524

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

15321536
exports[`.toContain(), .toContainEqual() '[0, 1]' contains '1' 1`] = `

packages/expect/src/matchers.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ const matchers: MatchersObject = {
313313
` ${printReceived(collection)}\n` +
314314
`To contain value:\n` +
315315
` ${printExpected(value)}` +
316-
(suggestToContainEqual ? ` ${SUGGEST_TO_CONTAIN_EQUAL}` : '')
316+
(suggestToContainEqual ? `\n\n${SUGGEST_TO_CONTAIN_EQUAL}` : '')
317317
);
318318
};
319319

0 commit comments

Comments
 (0)