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

expect: Improve report when matcher fails, part 16 #8306

Merged
merged 4 commits into from Apr 13, 2019
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -3,6 +3,7 @@
### Features

- `[expect]` Improve report when matcher fails, part 15 ([#8281](https://github.com/facebook/jest/pull/8281))
- `[expect]` Improve report when matcher fails, part 16 ([#8306](https://github.com/facebook/jest/pull/8306))
- `[jest-runner]` Pass docblock pragmas to TestEnvironment constructor ([#8320](https://github.com/facebook/jest/pull/8320))

### Fixes
Expand Down
10 changes: 3 additions & 7 deletions e2e/__tests__/__snapshots__/failures.test.ts.snap
Expand Up @@ -260,7 +260,7 @@ FAIL __tests__/testMacro.test.js

● use some imported macro to make assertion

expect(received).toEqual(expected)
expect(received).toEqual(expected) // deep equality

Expected: 2
Received: 1
Expand All @@ -286,9 +286,7 @@ FAIL __tests__/asyncFailures.test.js

● resolve, but fail

expect(received).toEqual(expected)

Difference:
expect(received).resolves.toEqual(expected) // deep equality

- Expected
+ Received
Expand All @@ -310,9 +308,7 @@ FAIL __tests__/asyncFailures.test.js

● reject, but fail

expect(received).toEqual(expected)

Difference:
expect(received).rejects.toEqual(expected) // deep equality

- Expected
+ Received
Expand Down
16 changes: 4 additions & 12 deletions packages/expect/src/__tests__/__snapshots__/extend.test.js.snap
@@ -1,9 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`defines asymmetric unary matchers 1`] = `
"<dim>expect(</><red>received</><dim>).toEqual(</><green>expected</><dim>)</>

Difference:
"<dim>expect(</><red>received</><dim>).</>toEqual<dim>(</><green>expected</><dim>) // deep equality</>

<green>- Expected</>
<red>+ Received</>
Expand All @@ -15,9 +13,7 @@ Difference:
`;

exports[`defines asymmetric unary matchers that can be prefixed by not 1`] = `
"<dim>expect(</><red>received</><dim>).toEqual(</><green>expected</><dim>)</>

Difference:
"<dim>expect(</><red>received</><dim>).</>toEqual<dim>(</><green>expected</><dim>) // deep equality</>

<green>- Expected</>
<red>+ Received</>
Expand All @@ -29,9 +25,7 @@ Difference:
`;

exports[`defines asymmetric variadic matchers 1`] = `
"<dim>expect(</><red>received</><dim>).toEqual(</><green>expected</><dim>)</>

Difference:
"<dim>expect(</><red>received</><dim>).</>toEqual<dim>(</><green>expected</><dim>) // deep equality</>

<green>- Expected</>
<red>+ Received</>
Expand All @@ -43,9 +37,7 @@ Difference:
`;

exports[`defines asymmetric variadic matchers that can be prefixed by not 1`] = `
"<dim>expect(</><red>received</><dim>).toEqual(</><green>expected</><dim>)</>

Difference:
"<dim>expect(</><red>received</><dim>).</>toEqual<dim>(</><green>expected</><dim>) // deep equality</>

<green>- Expected</>
<red>+ Received</>
Expand Down