klmr / box

Write reusable, composable and modular R code
https://klmr.me/box/
MIT License
833 stars 47 forks source link

Doesn't work with {shinytest} #257

Open mrismailt opened 2 years ago

mrismailt commented 2 years ago

Error description

> shinytest::recordTest()
Error in sd_startShiny(self, private, path, seed, loadTimeout, shinyOptions) : 
  Error starting application:
Loading required package: shiny
Warning: package 'shiny' was built under R version 4.0.5
Error in mapply(FUN = f, ..., SIMPLIFY = FALSE) : 
  Unable to load module "box/plot"; not found in "C:/Users/ismai/AppData/Local/Temp/RtmpgjcnP2"
(inside "find_in_path(spec, mod_search_path(caller))")

R version

platform       x86_64-w64-mingw32          
arch           x86_64                      
os             mingw32                     
system         x86_64, mingw32             
status                                     
major          4                           
minor          0.2                         
year           2020                        
month          06                          
day            22                          
svn rev        78730                       
language       R                           
version.string R version 4.0.2 (2020-06-22)
nickname       Taking Off Again

‘box’ version

1.0.2

GitHunter0 commented 1 year ago

Hi @klmr , I checked that it does not work with shinytest2 either. The packages loaded via box::use() in global.R are not being recognized, generating an error.

hypebright commented 11 months ago

Use options(box.path = getwd()).

I encountered similar issues using shinytest2 in combination with rhino because an issue with box ("Unable to load module"). After adding options(box.path = getwd()) to the shinytest2 test file it's working fine.

box version 1.1.3.