Skip to content

shinytest2::AppDriver$expect_values() fails on CI with invalid argument type during snapshot #2293

@schloerke

Description

@schloerke

With an implemented fix for #2288, a invalid argument type is caused at

if (!equal) {
.

Traceback:

2025-11-21T13:44:32.5296435Z ── Error ('test-app-image.R:46:3'): images are captured via expect_values ──────
2025-11-21T13:44:32.5296659Z Error in `!equal`: invalid argument type
2025-11-21T13:44:32.5296751Z Backtrace:
2025-11-21T13:44:32.5296836Z     ▆
2025-11-21T13:44:32.5297080Z  1. └─app$expect_values() at test-app-image.R:46:3
2025-11-21T13:44:32.5297377Z  2.   └─shinytest2:::app_expect_values(...)
2025-11-21T13:44:32.5297601Z  3.     ├─base::withCallingHandlers(...)
2025-11-21T13:44:32.5297824Z  4.     └─shinytest2:::app_expect_screenshot(...)
2025-11-21T13:44:32.5298068Z  5.       └─shinytest2:::app__expect_snapshot_file(...)
2025-11-21T13:44:32.5298272Z  6.         ├─base::withCallingHandlers(...)
2025-11-21T13:44:32.5298489Z  7.         └─testthat::expect_snapshot_file(...)

I believe this is from {shinytest2}'s want to muffle the failure during snapshot testing so that any screenshot snapshot made during AppDriver$expect_values() will never fail.

I believe the culprit is the method returning the result of snapshot_fail(), which is invisible(). If the failure is muffled, then the return value is NULL.

(PR incoming. Planning to instead continue down the path as if fail_on_new == FALSE)

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