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

Interactive Snapshot Update Mode outside of watch mode #8135

Closed
MichaReiser opened this issue Mar 16, 2019 · 9 comments
Closed

Interactive Snapshot Update Mode outside of watch mode #8135

MichaReiser opened this issue Mar 16, 2019 · 9 comments

Comments

@MichaReiser
Copy link
Contributor

馃殌 Feature Proposal

Make the interactive snapshot update mode available without requiring to use watch mode.

Add a new cli option --updateSnapshotInteractive that runs all tests and lets the user decide for each failing snapshot test whatever the snapshot should be updated.

Motivation

Jest Snapshots are an amazing feature with the main downside that users can tend to blindly update all failing snapshot tests without reviewing the changes (because it's that easy :)). This issue has been addressed by introducing interactive snapshot updates in watch mode.

Unfortunately, watch mode is considerably slower than the normal run mode resulting in long initial run times (+30minutes) when making changes to a file with many dependents (requiring a lot of tests to rerun) in a large repository (+1000 test suites). Users are, thereby, faster by updating all snapshots and reviewing the changes in the VCS diff (and reverting undesired updates). This has the downside that a user might miss an update or not reviewing the changes at all. Furthermore, reverting undesired snapshot requires manual work.

Example

jest --updateSnapshotInteractive
  • Jest runs all tests
  • For each failing snapshot test
    • Show the user the diff from the current snapshot to the new snapshot
    • Ask the user if the snapshot should be updated
    • Update the snapshot if the user decides to do so.

I'm not sure if Jest should first run all tests or showing the user the diffs as soon as a snapshot has failed (allows running the other tests in the background)

Pitch

Snapshots are a core functionality of Jest. The flow for updating snapshot should, thereby, be a core functionality as well. Furthermore, interactive snapshot updates are already part of jest core in watch mode.

@jeysal
Copy link
Contributor

jeysal commented Mar 16, 2019

Unfortunately, watch mode is considerably slower than the normal run mode resulting in long initial run times (+30minutes)

Unrelated to your feature proposal, but this surprises me. Running tests once in watch mode should in general not be slower than running the same set of tests outside of watch mode. Is there an open issue for this performance problem or could you perhaps create a repo that reproduces this on a smaller scale?

@thymikee
Copy link
Collaborator

@jeysal #7341

@jeysal
Copy link
Contributor

jeysal commented Mar 16, 2019

Ow, that one's bad. Unfortunately it's not magically resolved by the micromatch fix and it's going to be way harder to profile than the micromatch thing :/

@SimenB
Copy link
Member

SimenB commented Mar 17, 2019

I like the idea of this, I'm not sure how feasible it is if you want to avoid watch mode, though. The whole interactiveness is quite tied to watch mode

@worc
Copy link

worc commented Apr 10, 2019

watch triggers an EMFILE: too many open files for me. so the ability to do a single run through instead of bumping up against system limits would be pretty nice.

@Rossh87
Copy link

Rossh87 commented Feb 3, 2021

No movement on this for a bit now, and it looks like the performance issue that prompted the initial request has been resolved by #8201. @thymikee, is there still interest in implementing this, or safe to close?

@github-actions
Copy link

This issue is stale because it has been open for 1 year with no activity. Remove stale label or comment or this will be closed in 14 days.

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

This issue was closed because it has been stalled for 7 days with no activity. Please open a new issue if the issue is still relevant, linking to this one.

@github-actions
Copy link

github-actions bot commented May 2, 2022

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 2, 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

6 participants