rintrojs icon indicating copy to clipboard operation
rintrojs copied to clipboard

Add unit tests with shinytest

Open carlganz opened this issue 7 years ago • 8 comments

https://github.com/MangoTheCat/shinytest

carlganz avatar Sep 16 '16 15:09 carlganz

I can't seem to get shinytest to work with travis. Any thoughts @gaborcsardi

carlganz avatar Oct 07 '16 15:10 carlganz

Example failure?

gaborcsardi avatar Oct 07 '16 16:10 gaborcsardi

When I ran R CMD CHECK on my Mac with the shinytests it worked fine. On my Ubuntu, devtools::test() works fine, but when I run R CMD CHECK I get

Error in library(shinytest) : there is no package called 'shinytest'

Which is the error I get on travis for Linux and Mac. Am I missing something?

carlganz avatar Oct 07 '16 16:10 carlganz

I mean, can you please show me an actual Travis build that fails because of this problem?

gaborcsardi avatar Oct 07 '16 17:10 gaborcsardi

Oh of course, sorry:

https://travis-ci.org/carlganz/rintrojs/jobs/165728396

carlganz avatar Oct 07 '16 17:10 carlganz

OK, can you try again? I think this fixed it: https://github.com/MangoTheCat/shinytest/pull/52

In brief, shinytest starts another R process to run the app, and this process could not load your package, because it was not installed on the system. (And on Travis, the new R process also did not have the right library paths, anyway.)

Now we make sure that we set the same library path, as in the R process that runs the check and the tests.

I you test locally with devtools::test(), then you still need to devtools::install the package, so that shinytest loads the most recent version. We'll work around this at some point.

Btw. also note that the shinytest API will probably change significantly in the future.

gaborcsardi avatar Oct 08 '16 15:10 gaborcsardi

Thanks! Unfortunately I am still getting the same error on Travis and Ubuntu.

https://travis-ci.org/carlganz/rintrojs/jobs/166065610

carlganz avatar Oct 08 '16 18:10 carlganz

Yes, that's a different error, sorry.

I am not what is wrong, because according to the logs, shinytest is clearly installed. Maybe a caching problem? Can you try clearing the Travis cache?

gaborcsardi avatar Oct 09 '16 13:10 gaborcsardi