majestic icon indicating copy to clipboard operation
majestic copied to clipboard

Question: Is There A Way to Update All Snapshots Within A Project?

Open mcastre opened this issue 6 years ago • 5 comments

Hello! Not an issue per say, but a question. I just pulled down the project and i noticed there was a button to update the snapshot of an individual file. I was wondering if there was a way to update all snapshots from within the project? I know jest has a cmd to update all snaps, but I think it would be dope if Majestic had an update all button or something, if it doesnt already.

I love the software and its brillant! Great work!

mcastre avatar Mar 27 '19 13:03 mcastre

We should add this as a feature. Currently, there is no way to update all snapshots.

Thank you!

Raathigesh avatar Mar 28 '19 02:03 Raathigesh

For now you can add the -u flag to the majestic config in your package.json.

M4cs avatar Mar 28 '19 16:03 M4cs

Hey, I would like to have a go a this feature :)

Do you have a general idea as to where the button should be? At first I thought top of the side bar but I don't think it's a good idea to have that button be very "attractive" to click because a less experienced Jest user could update them all without really knowing what that means. So maybe a bit less visible would be best.

Maybe next to the little "Refresh" button on the side bar? Also possibly raising a "confirm" dialog or something of that nature...

Luanf avatar Apr 03 '19 00:04 Luanf

Thank you for taking this up.

If we show a confirmation dialog, then I'm comfortable having it next to the 'Run All' button with a descriptive tooltip like "Updates all the snapshots".

Also to show this button, we need to know if any are any snapshot failures so far. We could inspect the test results as they arrive and set a variable to indicate if there are snapshot failures and then pass the variable via the Summary so the UI would know when to show the button.

if you run into issues or blockers, feel free to ping here so I could help out.

Raathigesh avatar Apr 03 '19 00:04 Raathigesh

Would this make sense as a toggle next to both the Run tests and Run buttons, so you can toggle whether snapshots should be updated when running all tests or just a single file?

AndrewLeedham avatar Jun 24 '19 14:06 AndrewLeedham