-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
CLI Mode where snapshots must be approved before they are saved #1798
Comments
Maybe something like |
Maybe it makes sense to require When I first use This would be a breaking change though. |
I think we could connect this with interactively updating the snapshots so it's more convenient. |
Come up with the same idea. How about extra flag How about actually start working on it? I can contribute, if I will get a starting point for it. |
I think here is where I'd start:
I'd start looking at watch.js and getting the list of test results and then trying to apply that as "pattern" + testNamePattern (See #1860, which we may need for this as well). |
To fix this issue, I came up with this. http://g.recordit.co/0vJJvBDofA.gif I tried to show each individual failed snapshot, but did not succeed yet. I would love some feedback on the UX before submitting a PR. |
That's awesome. Please submit a PR. |
I submitted a PR, but need some help on how to write tests for the "watch.js". |
I was just thinking about this feature and wanting to implement it, thanks for making it happen @genintho! |
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. |
Do you want to request a feature or report a bug?
Feature Request
What is the current behavior?
I sometimes like to write my tests before writing my implementation (TDD/BDD/etc). Occasionally while doing this, I need to assert some large output that I feel is best handled using a snapshot. However, I don't want to write the snapshot to disk until the code has been implemented, because I'll have to keep updating it. So I write this a lot:
I use this as a placeholder that I expect to fail, and then once I'm ready to write the snapshot, I change it to the
toMatchSnapshot
matcher, then go review the snapshot (but if it was wrong, then I need to either keep updating it, or delete the snapshot).It'd be nice if the watcher had a mode where it didn't write snapshots until I approved them, and if I didn't approve them by the time tests had to run again, it would move on without writing anything. As a bonus, I think requiring approval would help encourage me to verify my snapshot content rather than writing whatever the current behavior is and calling it good, at risk that it's not (which is very easy to do with snapshots right now).
If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal repository on GitHub that we can
npm install
andnpm test
.N/A
What is the expected behavior?
N/A
Run Jest again with
--debug
and provide the full configuration it prints. Please mention your node and npm version and operating system.N/A
The text was updated successfully, but these errors were encountered: