Make `-u` option more user friendly and less error-prone
See original GitHub issueš Feature Proposal
Basically after seeing this interactive snapshot updater I think it would make sense if the -u
option were to show a prompt to update snapshots similar to running in interactive mode.
Additionally I would propose a -U
(or other unused flag) to be equal to the current behavior
Motivation
I think snapshot testing is awesome! But Iāve been having a hard time convincing a coworker and heās got a valid point about the -u
option, itās entirely too easy to update all the snapshots and let stuff slip in. If the -u
option were to use the interactive prompts for updating with diff views and the -U
option were to clearly state itās an āunsafeā option and do a y/n
confirm I think itād make the user experience around snapshot testing more explicit.
Pitch
The core Jest experience shouldnāt make it easy to shoot yourself in the foot like the current -u
option does.
Issue Analytics
- State:
- Created 5 years ago
- Comments:10 (3 by maintainers)
Top GitHub Comments
I think it actually makes sense to make updating all the snapshots a bit harder, especially that we now can update snapshots one by one, but only in watch mode. We just need to figure out the best way to do it. How about this flow:
u
I think itās nice to be able to continue by pressing
u
once more, just not be too annoying.I guess I donāt really see this as a foot-gun if youāre following best practices