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

Inverting colors in snapshot tests #6379

Closed
ghost opened this issue Jun 2, 2018 · 4 comments
Closed

Inverting colors in snapshot tests #6379

ghost opened this issue Jun 2, 2018 · 4 comments

Comments

@ghost
Copy link

ghost commented Jun 2, 2018

💬 Questions and Help

I'm using create-react-app with jest for snapshot tests. Here's a sample output:

screenshot 2018-06-02 10 31 01

My team is finding this a bit difficult to grok, since the usual diff format they're used to (unix diff and git), uses red for an existing value, and green for the new value. Jest uses the opposite. I understand why it's done this way from the docs, but it's quite jarring in practice.

Is there a way to invert these colors?

Please note that this issue tracker is not a help form and this issue will be closed.

For questions or help please see:

@quantizor
Copy link
Contributor

The output is technically correct when you consider the intention of the test.

When a snapshot has been written, it's considered the source of truth. Thus any diff to the snapshot introduced by a new test run would show in red, since it as a deviation from the source of truth.

@quantizor
Copy link
Contributor

If anything, the green color could probably be changed to something else to remove this false allusion to standard diffs. Perhaps just white.

@SimenB
Copy link
Member

SimenB commented Jun 2, 2018

Duplicate of #5430

@SimenB SimenB marked this as a duplicate of #5430 Jun 2, 2018
@SimenB SimenB closed this as completed Jun 2, 2018
@github-actions
Copy link

This issue 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.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants