Description
Issue
This could be a bug or a feature - I'm still actually digging into this but wanted to open an issue because you might be able to dig into it faster (if you've not already come across this!)
It looks like when running with -count
(i.e. go test -count 5 ./...
) in some (if not all?) cases snapshots get counted multiple times for the same test rather than recompared - i.e. the snapshot gets updated with [TestRun/#00 - n]
where n
is the number of snapshots called so far across all runs.
I think this is because the test ids are using a global registry + mutex and that -count
is working within the same process, it just calls the test functions multiple times.
I think this could be worked around by exposing a way of manually clearing/resetting the registry, which could be called before every test in TestMain
, but I've not yet tested that to confirm.
I'm also not sure if something like golang/go#64883 would make it possible for the library to handle this automatically.