🚀 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.
🚀 Feature Proposal
Make the interactive snapshot update mode available without requiring to use watch mode.
Add a new cli option
--updateSnapshotInteractivethat 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
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.