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, jest-matcher-utils: Improve report when matcher fails, part 9 #7940

Merged
merged 5 commits into from
Feb 22, 2019

Conversation

pedrottimark
Copy link
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
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
Contributor

@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

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