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

Cannot display full error trace #369

Open
alex-silverman opened this issue Nov 15, 2023 · 0 comments
Open

Cannot display full error trace #369

alex-silverman opened this issue Nov 15, 2023 · 0 comments

Comments

@alex-silverman
Copy link

Context
When I run my shiny app in R Studio Server (linux), in my console I see all the custom logging statements from my server.R script, and, importantly, the error that caused the app to crash (i.e. "Column ExitAdjust doesn't exist"):

image

Brief explanation of how the app works
The user uploads a zip file, which the app then processes in sequential steps, beginning with the "Running get export" step, then "Running dates", ..., then "Running initial data prep". (There are actually a few more steps that are supposed to run after that, but the app is crashing during that last step because I'm trying to select() a column (ExitAdjust) from a dataframe that doesn't contain that column. That's all expected behavior - the app should crash!

My Issue
How do I get shinytest2 to reflect that same error? When I run my test, I don't see the error in the console. Instead, I get something like this:

image

Relevant code behind the test:

test_that(paste0("{shinytest2} recording: ",test_script_name), {
    print(paste0("Running ",test_script_name))
  
    app <- AppDriver$new(
      variant = platform_variant(os_name = FALSE), 
      name = test_script_name, 
      seed = 12345,
      load_timeout = 1e+05)

    app$set_inputs(Go_to_upload = "click")
    app$upload_file(imported = paste0("../",test_dataset))
    app$expect_values() # FAILS HERE BECAUSE APP HASN'T FINISHED PROCESSING BECAUSE OF THE AFOREMENTIONED ERROR
})

The test is opening the app, going to the page where the file gets uploaded, uploading the file, then trying to take a snapshot. Unsurprisingly, the test fails trying to take the snapshot because the app never finishes processing the uploaded file due to the aforementioned error. Unfortunately, though, the log isn't very helpful. I.e., it's not clear WHY the app is failing.

What should happen
Ideally, it would print all the same stuff as when I run the app regularly, but especially the error message.

What I've tried
I've tried the following things, but saw no changes in the log:

  • Add to my app initialization: options = list(shiny.trace = TRUE, shiny.fullstacktrace = TRUE)
  • Add to my app initialization: options = list(shiny.trace = TRUE)
  • Add below my app initialization: app$get_logs()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant