autogold icon indicating copy to clipboard operation
autogold copied to clipboard

Suggestions for -update behavior

Open rvantonder opened this issue 5 years ago • 1 comments

What will I do with all the free time I get from using autogold? :-)

I noticed two things that could probably improve -update behavior, based on my experience with similar workflows (Jest updateSnapshot and OCaml expect tests):

  1. Silently succeed when update succeeds (exit 0, no messages). This would be consistent behavior with what I've seen elsewhere. I noticed that the current behavior prints "Fail", shows the diff, and exits 1 the first time -update is passed. This makes me wonder if the tests updated, since it matches the output of not running the test with -update. It would also be useful for autogold then to reserve printing something for an -update command only in case of an autogold warning or error, e.g., if it couldn't update a test for some reason.

  2. I noticed -update will only update one test value at a time, so I have to do like for i in seq 1 20; do go test -update; done until I notice it's done. Would be great if it updated all the test values at once.

rvantonder avatar Jan 07 '21 22:01 rvantonder

Thanks for filing!

  1. Definitely agree we should match Jest and OCaml behavior here (make -update not fail).
  2. Will be fixed by making -update not fail.

Since this is a breaking change, and there are a few other breaking changes I'd like to make soon-ish, I'll tag this as v2. https://github.com/hexops/autogold/issues?q=is%3Aissue+is%3Aopen+label%3Av2

emidoots avatar Jan 08 '21 03:01 emidoots