Skip to content

Commit 6cc2a85

Browse files
phapp88pedrottimark
authored andcommitted
Update toEqual failure message (#7325)
* Update toEqual failure message * Update changelog * Update failing snapshots * Show one line reports * Update failure message when diffString is null * Update failing snapshot * Update failure message for jest-diff edge cases
1 parent 722049c commit 6cc2a85

File tree

7 files changed

+202
-461
lines changed

7 files changed

+202
-461
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@
9090
- `[jest-config]` Use strings instead of `RegExp` instances in normalized configuration ([#7251](https://github.com/facebook/jest/pull/7251))
9191
- `[jest-circus]` Make sure to display real duration even if time is mocked ([#7264](https://github.com/facebook/jest/pull/7264))
9292
- `[expect]` Improves the failing message for `toStrictEqual` matcher. ([#7224](https://github.com/facebook/jest/pull/7224))
93+
- `[expect]` Improves the failing message for `toEqual` matcher. ([#7325](https://github.com/facebook/jest/pull/7325))
9394
- `[jest-resolve]` Fix not being able to resolve path to mapped file with custom platform ([#7312](https://github.com/facebook/jest/pull/7312))
9495
- `[jest-message-util]` Improve parsing of error messages for unusually formatted stack traces ([#7319](https://github.com/facebook/jest/pull/7319))
9596
- `[jest-runtime]` Ensure error message text is not lost on errors with code frames ([#7319](https://github.com/facebook/jest/pull/7319))

e2e/__tests__/__snapshots__/failures.test.js.snap

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -272,10 +272,8 @@ exports[`works with assertions in separate files 1`] = `
272272
273273
expect(received).toEqual(expected)
274274
275-
Expected value to equal:
276-
2
277-
Received:
278-
1
275+
Expected: 2
276+
Received: 1
279277
280278
10 |
281279
11 | module.exports = (one: any, two: any) => {
@@ -302,11 +300,6 @@ exports[`works with async failures 1`] = `
302300
303301
expect(received).toEqual(expected)
304302
305-
Expected value to equal:
306-
{\\"baz\\": \\"bar\\"}
307-
Received:
308-
{\\"foo\\": \\"bar\\"}
309-
310303
Difference:
311304
312305
- Expected
@@ -331,11 +324,6 @@ exports[`works with async failures 1`] = `
331324
332325
expect(received).toEqual(expected)
333326
334-
Expected value to equal:
335-
{\\"baz\\": \\"bar\\"}
336-
Received:
337-
{\\"foo\\": \\"bar\\"}
338-
339327
Difference:
340328
341329
- Expected

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

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,6 @@
33
exports[`defines asymmetric unary matchers 1`] = `
44
"<dim>expect(</><red>received</><dim>).toEqual(</><green>expected</><dim>)</>
55
6-
Expected value to equal:
7-
<green>{\\"value\\": toBeDivisibleBy<2>}</>
8-
Received:
9-
<red>{\\"value\\": 3}</>
10-
116
Difference:
127
138
<green>- Expected</>
@@ -22,11 +17,6 @@ Difference:
2217
exports[`defines asymmetric unary matchers that can be prefixed by not 1`] = `
2318
"<dim>expect(</><red>received</><dim>).toEqual(</><green>expected</><dim>)</>
2419
25-
Expected value to equal:
26-
<green>{\\"value\\": not.toBeDivisibleBy<2>}</>
27-
Received:
28-
<red>{\\"value\\": 2}</>
29-
3020
Difference:
3121
3222
<green>- Expected</>
@@ -41,11 +31,6 @@ Difference:
4131
exports[`defines asymmetric variadic matchers 1`] = `
4232
"<dim>expect(</><red>received</><dim>).toEqual(</><green>expected</><dim>)</>
4333
44-
Expected value to equal:
45-
<green>{\\"value\\": toBeWithinRange<4, 11>}</>
46-
Received:
47-
<red>{\\"value\\": 3}</>
48-
4934
Difference:
5035
5136
<green>- Expected</>
@@ -60,11 +45,6 @@ Difference:
6045
exports[`defines asymmetric variadic matchers that can be prefixed by not 1`] = `
6146
"<dim>expect(</><red>received</><dim>).toEqual(</><green>expected</><dim>)</>
6247
63-
Expected value to equal:
64-
<green>{\\"value\\": not.toBeWithinRange<1, 3>}</>
65-
Received:
66-
<red>{\\"value\\": 2}</>
67-
6848
Difference:
6949
7050
<green>- Expected</>

0 commit comments

Comments
 (0)