Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorect code coverage using covr on shinytest2 + testthat tests #250

Closed
StatisMike opened this issue Aug 29, 2022 · 0 comments · Fixed by #259
Closed

Incorect code coverage using covr on shinytest2 + testthat tests #250

StatisMike opened this issue Aug 29, 2022 · 0 comments · Fixed by #259
Labels
bug Something isn't working
Milestone

Comments

@StatisMike
Copy link

I've encountered a problem during calculation of code coverage using covr. Even though the tests scripts were executing lines, they were not appearing in the results of covr::package_coverage().

Issue was reported there, and it seems like, as the answer here points out, the app_stop() is executing SIGKILL too soon for covr to trace the lines.

Using this answer as a guidelines, I was able to countermeasure this problem using a simple function that is executed before calling app$stop():

app_wait <- function(app,
                     time = 1000) {
  
  app$.__enclos_env__$private$shiny_process$interrupt()
  app$.__enclos_env__$private$shiny_process$wait(timeout = time)
}

I suggest either upping the time before the SIGKILL execution or providing the user an option to overwrite this time.

@schloerke schloerke added the bug Something isn't working label Aug 29, 2022
@schloerke schloerke added this to the v0.2.0 milestone Aug 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants