-
Notifications
You must be signed in to change notification settings - Fork 363
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
Better default for Jest UpdateSnapshot #3487
Comments
There's a separate mechanism that fails PR builds if they have any mutations, including snapshot changes (or mutates the PR if you are using mutable PRs). And PRs require reviews, so this is still fine. A lot of folks don't agree with this approach, so we probably ought to change the default at some point. My very personal opinion is that I like to view snapshot changes using the file system and my IDEs diff tool, not whatever jest puts on the command line. From a untrusted code standpoint, there's also no guarantee that someone has actually looked at the snapshot changes and decided they are good vs just re-run the test with |
My biggest concern with this approach is that it runs counter to standard testing workflows, at least the ones I'm used to: Write some tests, run What happens if someone accidentally runs |
Yeah, I understand that concern. It's totally valid, hence why I think the default should change. My only response to this is that the developer has to actively ignore the pending local changes and decide to not commit them to even get into this situation. |
For the test task, it looks like the default behavior is for jest to run with the --update-snapshot flag. This seems to be the case even in projen's own builds.
I'm new to snapshot testing, but based on some simple testing, that seems to mean that tests always pass as snapshots are just always updated and code changes never fail. Shouldn't the default be
UpdateSnapshot.NEVER
? Indeed, it seems like that was the intention of this code.The text was updated successfully, but these errors were encountered: