r-lib / devtools

Tools to make an R developer's life easier
https://devtools.r-lib.org
Other
2.37k stars 755 forks source link

FR: export `testthat::snapshot_review()` #2528

Closed olivroy closed 11 months ago

olivroy commented 11 months ago

Hi,

I was wondering if devtools could export testthat::snapshot_review()?.

It could improve the workflow a little when hyperlinks are buggy, see rstudio/rstudio#13088, it would require less typing.

Maybe consider exporting testthat::snapshot_accept() also.

Thanks

Edit: I can contribute a PR if you think this is reasonable.

hadley commented 11 months ago

This is the devtools package, so it's not the right place.

But these functions should already be avialable to you because by default load_all() will attach testthat.

olivroy commented 10 months ago

Oh I opened this FR in response to an issue of having clickable hyperlinks not working with the Run Tests button. r-lib/testthat#1846

The this worfklow

  1. get a warning that a snapshot test is failing or you just restarted session.
  2. go to that test location
  3. Click the run tests button
  4. In this case, since load_all() was not run.snapshot_review()can't autocomplete. hence the need to typetestthat::snapshot_review()` by hand (because testthat is not loaded)

However, devtools is loaded in r profile per https://usethis.r-lib.org/reference/rprofile-helper.html?q=rprofi#null hence the reasoning behind this FR