Skip to content

Cannot display full error trace #369

@alex-silverman

Description

@alex-silverman

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()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions