vscode-jest
vscode-jest copied to clipboard
Remove obsolete snapshots
Environment
-
node -v: v8.4.0 -
npm -v: 5.3.0 -
npm ls react-scripts(if you haven’t ejected): N/A -
Operating system: macOS High Sierra Version 10.13.3
Steps to Reproduce
- Open a test file that contains a snapshot expectation
- Add a snapshot expectation (this will get generated)
- Remove snapshot expectation (this will not get removed)
Expected Behavior
Removal of snapshot expectation would remove obsolete snapshot (or a dialog would appear asking if I'd like to update my snapshots and remove obsolete)
Actual Behavior
Removal of snapshot expectation does not remove obsolete snapshot (or show a dialog asking if I'd like to update my snapshots and remove obsolete)
Am I misunderstood? It seems that if I add a new snapshot expectation, I will be prompted to update my snapshots and this will remove any obsolete; however, this is not an ideal workflow.
I started using this extension to replace the need to run my tests in the terminal, but it seems I may need to still do this in the case where I have obsolete snapshots.
Makes sense, want to try take a look at adding this?
+1
I just run jest --updateSnapshot and that flag removes obsolete snapshots
When jest is running, you can press W, see the options, press U.
Watch Usage
› Press u to update failing snapshots.
Or go to the snapshots folder in the same folder of your test and delete them.
@estevanpedro
This is not realy a solution no. The files still remain ...
This is a really old thread. Since v5.1, you should be able to run update snapshot (via test menu) to remove obsolete snapshots.
Close this as this feature is available now.