rstudio / shinytest

Automated testing for shiny apps
https://rstudio.github.io/shinytest/
Other
225 stars 55 forks source link

use load_all() in pkg workflow #398

Closed maxheld83 closed 3 years ago

maxheld83 commented 3 years ago

this is a shot at https://github.com/rstudio/shinytest/issues/397.

Just placing devtools::load_all() in the app.R solves the problem for me, and brings shinytest in line with my normal testthat workflow, but I don't know enough about shinytest internals to be certain that this works broadly.

The apps under inst/ should also work because, as I recall, devtools::load_all() shims system.file().

schloerke commented 3 years ago

I would rather we mention to reinstall where appropriate, rather than using devtools::load_all().

While load_all() works for foreground R process testing, shinytest spawns a background R process that requires the packages to be installed

maxheld83 commented 3 years ago

While load_all() works for foreground R process testing, shinytest spawns a background R process that requires the packages to be installed

Though as long as shinytest spawns the background with the same working directory (package root) devtools::load_all() should work in the background process, too, correct?

schloerke commented 3 years ago

It will work locally, yes.

But it will not work when I install and test your package on my machine, or when I run revdepcheck on your R package.

devtools::load_all() should not exist within a package's R code. (GREAT for local development, though).

maxheld83 commented 3 years ago

devtools::load_all() should not exist within a package's R code. (GREAT for local development, though).

A yes of course 😬