Skip to content

expect, jest-matcher-utils: Improve report when matcher fails, part 9#7940

Merged
SimenB merged 5 commits intojestjs:masterfrom
pedrottimark:improve-report-9
Feb 22, 2019
Merged

expect, jest-matcher-utils: Improve report when matcher fails, part 9#7940
SimenB merged 5 commits intojestjs:masterfrom
pedrottimark:improve-report-9

Conversation

@pedrottimark
Copy link
Copy Markdown
Contributor

Summary

For matcher error in:

  • .toBeCloseTo
  • .toBeGreaterThan
  • .toBeGreaterThanOrEqual
  • .toBeLessThan
  • .toBeLessThanOrEqual

When expected or received must be a number:

  • Because matcher name does not include period, display in black instead of dim color
  • With options argument, display .not or .rejects or .resolves

In ensureActualIsNumber and ensureExpectedIsNumber functions:

  • Support backward compatible [.not] and dim matcher name if it does include period.
  • Delete 'This matcher' default for matcherName arg. I doubt it has ever been used.

Residue provide options to ensureExpectedIsNumber calls when we improve spy matchers:

  • .toHaveBeenCalledTimes and .toBeCalledTimes
  • .toHaveReturnedTimes and .toReturn

Test plan

  • jest-matcher-utils: updated 2 snapshot tests and added 6 new snapshot tests
  • expect matchers: added 6 new snapshots tests to .toBeCloseTo as integration test
  • expect spyMatchers: 48 snapshot tests unchanged backward compatibility (see Residue)

Copy link
Copy Markdown
Member

@SimenB SimenB left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is awesome, as always. Thanks!

Copy link
Copy Markdown
Collaborator

@jeysal jeysal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good 👍

@github-actions
Copy link
Copy Markdown

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators May 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants