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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature]: Add options to ignore snapshot diffs and suppress their output #12240

Closed
gwerbin opened this issue Jan 14, 2022 · 4 comments
Closed

Comments

@gwerbin
Copy link

gwerbin commented Jan 14, 2022

馃殌 Feature Proposal

I want to be able to run the test suite and either (or both):

  1. Ignore changes in snapshots, so that they are not reported as failures
  2. Do not print the snapshot diffs while the test is running, so that it's easier to scroll up and see which tests failed, along with any associated console.log output. Maybe the snapshot diffs can be optionally written to a log file instead of stdout.

Motivation

Sometimes, I know that my snapshots have changed, and sometimes the diffs can be huge.

These huge diffs make it very very difficult to scroll back and see other details about individual test failures.

It appears that this is not currently possible, because I don't see anything about it in any docs that I could find, and my Stackoverflow question has gone unanswered.

Example

I work on an application that uses Apollo GraphQL. Apollo recognizes the DEBUG environment variable, so that it returns debugging output in GraphQL responses. If I run Node/Jest with DEBUG=1, this causes a lot of my snapshots to change, but I don't care about 99% of those changes. I only care about a few error messages that I am logging through the application.

Other times, I simply want to produce a list of test suites/assertions that have failed, without such detailed output. There does not appear to be any functionality to do this.

Pitch

I don't believe it is possible to extend Jest in this fashion. I tried using something called jest-silent-reporter, but it did not change the snapshot diff output.

Note that I am not really a NodeJS user, so I apologize if this is possible somehow, but I am too ignorant to ask the right questions, use the right search terms, etc.

@github-actions
Copy link

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.

@github-actions github-actions bot added the Stale label Feb 25, 2022
@gwerbin
Copy link
Author

gwerbin commented Feb 25, 2022

I would appreciate a response from the team on this. I don't think it's fair to close un-answered feature requests as "stale" in such a short amount of time. Even a "no, wontfix" is fine.

@github-actions github-actions bot removed the Stale label Feb 25, 2022
@SimenB
Copy link
Member

SimenB commented Feb 26, 2022

I don't think we want to make this configurable. What you can do is write a custom reporter (jest-silent-reporter might be open to taking a PR with an option for what you want, or you can look at it as inspiration for your own).

And yeah, the bot is kinda aggressive, sorry about that! See #12496 for background

@SimenB SimenB closed this as completed Feb 26, 2022
@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 Mar 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants