usethis icon indicating copy to clipboard operation
usethis copied to clipboard

How to browse snapshots from a test file?

Open maelle opened this issue 2 years ago • 5 comments

(Maybe rather an IDE question)

If I'm reading tests to gain an understanding of what the code is doing, how can I easily access the snapshots? Currently I do that by clicking.

More often of course I interact with snapshots when they fail or when I add some. :sweat_smile:

maelle avatar Oct 05 '23 14:10 maelle

I have wondered if we need a use_snapshot() to parallel use_r()/use_test()

hadley avatar Oct 30 '23 16:10 hadley

I was just thinking that use_snapshot() would be helpful, then found this!

fh-mthomson avatar Nov 29 '23 03:11 fh-mthomson

Moving this to usethis

hadley avatar Aug 07 '25 16:08 hadley

Similarly it would be nice if use_r()/use_test() took you to the right place when a snapshot file was open.

hadley avatar Aug 07 '25 16:08 hadley

lol I have no memory of ❤️ing this.

use_r("filename") and use_test("filename") do things that make sense when the files don't exist. For use_snapshot("filename"), we'd require that the snapshot already exists, right? I assume the signature should look like this:

use_snapshot(name = NULL, variant = NULL, open = rlang::is_interactive())

I'll probably go ahead and knock this out real quick assuming those thoughts are valid, I just wanted to think through it in case something didn't make sense.

jonthegeek avatar Sep 19 '25 19:09 jonthegeek