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-snapshot: Change color from green for some args in matcher hints #8812

Merged
merged 2 commits into from
Aug 12, 2019

Conversation

pedrottimark
Copy link
Contributor

Summary

For matcher args which do not have a received counterpart in red color:

  • precision in toBeCloseTo
  • n in toHaveBeenNthCalledWith and toHaveNthReturnedWith
  • hint in toMatchSnapshot and toThrowErrorMatchingSnapshot

Especially for matchers whose 2 arguments have different effect on criterion

However, either path or value in toHaveProperty can have received counterpart:

toHaveProperty 1

toHaveProperty 2

Test plan

Updated 97 snapshots

matcher
17 toBeCloseTo
15 nthCalledWith
25 nthReturnedWith
15 toHaveBeenNthCalledWith
25 toHaveNthReturnedWith

See also pictures in following comments

Baseline at left and improved at right

@pedrottimark
Copy link
Contributor Author

Visually distinguish precision in black from values and differences in green and red

toBeCloseTo

Residue: throw matcher error because precision must be integer (breaking change)

@pedrottimark
Copy link
Contributor Author

Black color for n in hint matches label in report:

nthCalledWith 2

nthReturnedWith 2

Here are matcher errors with color change:

nthCalledWith 1

nthReturnedWith 1

@pedrottimark
Copy link
Contributor Author

Remove inconsistency between green in hint and black in label:

toMatchSnapshot 1

Baseline above and improved below

toThrowErrorMatchingSnapshot

Visually distinguish hint from properties which can green-red color contrast:

toMatchSnapshot 2

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.

Oh yeah, this is really great! Less noise

@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 11, 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