Skip to content

Commit

Permalink
Update toEqual failure message (jestjs#7325)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
phapp88 authored and captain-yossarian committed Jul 18, 2019
1 parent 52ba7cb commit e6f9056
Show file tree
Hide file tree
Showing 7 changed files with 202 additions and 461 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@
- `[jest-config]` Use strings instead of `RegExp` instances in normalized configuration ([#7251](https://github.com/facebook/jest/pull/7251))
- `[jest-circus]` Make sure to display real duration even if time is mocked ([#7264](https://github.com/facebook/jest/pull/7264))
- `[expect]` Improves the failing message for `toStrictEqual` matcher. ([#7224](https://github.com/facebook/jest/pull/7224))
- `[expect]` Improves the failing message for `toEqual` matcher. ([#7325](https://github.com/facebook/jest/pull/7325))
- `[jest-resolve]` Fix not being able to resolve path to mapped file with custom platform ([#7312](https://github.com/facebook/jest/pull/7312))
- `[jest-message-util]` Improve parsing of error messages for unusually formatted stack traces ([#7319](https://github.com/facebook/jest/pull/7319))
- `[jest-runtime]` Ensure error message text is not lost on errors with code frames ([#7319](https://github.com/facebook/jest/pull/7319))
Expand Down
16 changes: 2 additions & 14 deletions e2e/__tests__/__snapshots__/failures.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -272,10 +272,8 @@ exports[`works with assertions in separate files 1`] = `
expect(received).toEqual(expected)
Expected value to equal:
2
Received:
1
Expected: 2
Received: 1
10 |
11 | module.exports = (one: any, two: any) => {
Expand All @@ -302,11 +300,6 @@ exports[`works with async failures 1`] = `
expect(received).toEqual(expected)
Expected value to equal:
{\\"baz\\": \\"bar\\"}
Received:
{\\"foo\\": \\"bar\\"}
Difference:
- Expected
Expand All @@ -331,11 +324,6 @@ exports[`works with async failures 1`] = `
expect(received).toEqual(expected)
Expected value to equal:
{\\"baz\\": \\"bar\\"}
Received:
{\\"foo\\": \\"bar\\"}
Difference:
- Expected
Expand Down
20 changes: 0 additions & 20 deletions packages/expect/src/__tests__/__snapshots__/extend.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@
exports[`defines asymmetric unary matchers 1`] = `
"<dim>expect(</><red>received</><dim>).toEqual(</><green>expected</><dim>)</>
Expected value to equal:
<green>{\\"value\\": toBeDivisibleBy<2>}</>
Received:
<red>{\\"value\\": 3}</>
Difference:
<green>- Expected</>
Expand All @@ -22,11 +17,6 @@ Difference:
exports[`defines asymmetric unary matchers that can be prefixed by not 1`] = `
"<dim>expect(</><red>received</><dim>).toEqual(</><green>expected</><dim>)</>
Expected value to equal:
<green>{\\"value\\": not.toBeDivisibleBy<2>}</>
Received:
<red>{\\"value\\": 2}</>
Difference:
<green>- Expected</>
Expand All @@ -41,11 +31,6 @@ Difference:
exports[`defines asymmetric variadic matchers 1`] = `
"<dim>expect(</><red>received</><dim>).toEqual(</><green>expected</><dim>)</>
Expected value to equal:
<green>{\\"value\\": toBeWithinRange<4, 11>}</>
Received:
<red>{\\"value\\": 3}</>
Difference:
<green>- Expected</>
Expand All @@ -60,11 +45,6 @@ Difference:
exports[`defines asymmetric variadic matchers that can be prefixed by not 1`] = `
"<dim>expect(</><red>received</><dim>).toEqual(</><green>expected</><dim>)</>
Expected value to equal:
<green>{\\"value\\": not.toBeWithinRange<1, 3>}</>
Received:
<red>{\\"value\\": 2}</>
Difference:
<green>- Expected</>
Expand Down
Loading

0 comments on commit e6f9056

Please sign in to comment.