testthat icon indicating copy to clipboard operation
testthat copied to clipboard

Provide `path` for `snapshot_review()` hint

Open schloerke opened this issue 2 years ago • 2 comments

When running a test with a default path of ./tests/testthat, the snapshot hint makes sense:

Run `testthat::snapshot_review('app-set-inputs/')` to review changes

However, it would be nice to the have the starting location in the hint if the starting location is not ./tests/testthat.

testthat::test_dir("a/b/c/d/tests/testthat")
#> .....
#> Run `testthat::snapshot_review('app-set-inputs/', 'a/b/c/d/tests/testthat')` to review changes
#> .....

schloerke avatar Feb 17 '22 16:02 schloerke

This is especially confusing for people who are using shinytest2, because the testthat tests on a packaged shiny app are usually run in ./inst/app/tests/testthat

jonathan-g avatar Jul 12 '22 19:07 jonathan-g

We have also hit this, as we are using testthat to test R code outside of an R package, and those tests happen to live in test/R beneath the project repository root.

aronatkins avatar Aug 09 '23 12:08 aronatkins