Skip to content

comparing two figures fails on github #162

Open

Description

@shug0131

I want to check that two versions of a figure are identical, and not affected by changing some options

fig2 <- km_ggplot(fit, pval = TRUE)
vdiffr::expect_doppelganger("pvalue", fig2, variant = operating_system )
options("cctu_p_digits" = NULL)
fig4 <- km_ggplot(fit, pval = TRUE)
vdiffr::expect_doppelganger("pvalue", fig4, variant = operating_system )

So I'm using the pvalue snapshot file twice over. The logic is

fig2=pvalue & fig4=pvalue => fig2=fig4 .

This works fine locally, but on github it has a problem with re-using the pvalue snapshot file

Error in testthat::expect_snapshot_file(testcase, name = file, cran = cran, variant = variant, compare = testthat::compare_file_text): Snapshot file names must be unique. name has already been used.

Activity

  1. trevorld commented on Feb 20, 2026

    @trevorld
    • I speculate that locally you have an older version of {testthat} whereas github is running a newer version of {testthat}.

    • The release notes for {testthat} 3.3.0 (released on Nov. 13th, 2025) state that:

      expect_snapshot_file() now clearly errors if the path... has been used alreaday (Enforce that snapshot files should be unique testthat#1592)

      so this seems like the "expected" behavior going forward.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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