Skip to content

In CI, testthat says a snapshot is missing when it's notΒ #2329

@etiennebacher

Description

@etiennebacher

testthat keeps telling me that a snapshot is missing when it's not.

I have a simple demo in https://github.com/etiennebacher/test.snapshot.ci/:

  • R folder is empty
  • tests only contain test-print.R, which just has expect_snapshot(1 + 1)
  • the file tests/testthat/_snaps/print.md exists and contains the correct snapshot
  • I tried to keep the CI workflow at the minimum

devtools::check() passes locally, and yet in CI I see:

Last 13 lines of output:
  Saving _problems/test-print-2.R
  [ FAIL 1 | WARN 0 | SKIP 0 | PASS 1 ]
  
  ══ Failed tests ════════════════════════════════════════════════════════════════
  ── Failure ('test-print.R:2:3'): print ─────────────────────────────────────────
  Adding new snapshot:
  Code
    1 + 1
  Output
    [1] 2
  
  [ FAIL 1 | WARN 0 | SKIP 0 | PASS 1 ]
  Error:
  ! Test failures.

Note that the [ FAIL 1 | WARN 0 | SKIP 0 | PASS 1 ] is weird because there's a single test_that() with only one expectation, so how can there be two tests in the output?

This works fine with testthat 3.2.3 and starts erroring in 3.3.0.

Session info
─ Session info ──────────────────────────────────────────────────────────────────────────────────────
 setting  value
 version  R version 4.5.0 (2025-04-11)
 os       Ubuntu 24.04.4 LTS
 system   x86_64, linux-gnu
 ui       Positron
 language (EN)
 collate  en_US.UTF-8
 ctype    en_US.UTF-8
 tz       Europe/Paris
 date     2026-03-11
 pandoc   3.1.3 @ /usr/bin/pandoc
 quarto   1.9.27 @ /opt/quarto/bin/quarto

─ Packages ──────────────────────────────────────────────────────────────────────────────────────────
! package * version date (UTC) lib source
abind 1.4-8 2024-09-12 [1] RSPM
askpass 1.2.1 2024-10-04 [1] RSPM
backports 1.5.0 2024-05-23 [1] RSPM
base64enc 0.1-6 2026-02-02 [1] RSPM
bayesplot 1.15.0 2025-12-12 [1] RSPM
VP bayestestR * 0.17.0.2 2025-10-08 [?] https://easystats.r-universe.dev (R 4.5.0) (on disk 0.17.0.1)
boot 1.3-32 2025-08-29 [1] RSPM
bridgesampling 1.2-1 2025-11-19 [1] RSPM (R 4.5.0)
brio 1.1.5 2024-04-24 [1] RSPM
brms 2.23.0 2025-09-09 [1] RSPM
Brobdingnag 1.2-9 2022-10-19 [1] RSPM
cachem 1.1.0 2024-05-16 [1] RSPM
callr 3.7.6 2024-03-25 [1] RSPM
checkmate 2.3.4 2026-02-03 [1] RSPM
cli 3.6.5 2025-04-23 [1] RSPM (R 4.5.0)
coda 0.19-4.1 2024-01-31 [1] RSPM
codetools 0.2-20 2024-03-31 [2] CRAN (R 4.5.0)
colourpicker 1.3.0 2023-08-21 [1] RSPM
commonmark 2.0.0 2025-07-07 [1] RSPM (R 4.5.0)
credentials 2.0.3 2025-09-12 [1] RSPM (R 4.5.0)
crosstalk 1.2.2 2025-08-26 [1] RSPM (R 4.5.0)
curl 7.0.0 2025-08-19 [1] RSPM (R 4.5.0)
datawizard 1.3.0 2025-10-11 [1] RSPM
desc 1.4.3 2023-12-10 [1] RSPM
devtools 2.4.6 2025-10-03 [1] RSPM
digest 0.6.39 2025-11-19 [1] RSPM (R 4.5.0)
distributional 0.6.0 2026-01-14 [1] RSPM (R 4.5.0)
dplyr 1.2.0.9000 2026-03-01 [1] Github (tidyverse/dplyr@8730221)
DT 0.34.0 2025-09-02 [1] RSPM (R 4.5.0)
dygraphs 1.1.1.6 2018-07-11 [1] RSPM
ellipsis 0.3.2 2021-04-29 [1] RSPM
emmeans 2.0.1 2025-12-16 [1] RSPM
estimability 1.5.1 2024-05-12 [1] RSPM
evaluate 1.0.5 2025-08-27 [1] RSPM (R 4.5.0)
farver 2.1.2 2024-05-13 [1] RSPM
fastmap 1.2.0 2024-05-15 [1] RSPM
fs 1.6.6 2025-04-12 [1] CRAN (R 4.5.0)
generics 0.1.4 2025-05-09 [1] RSPM (R 4.5.0)
gert 2.3.1 2026-01-11 [1] RSPM (R 4.5.0)
ggplot2 4.0.2 2026-02-03 [1] RSPM
gh 1.5.0 2025-05-26 [1] RSPM (R 4.5.0)
gitcreds 0.1.2 2022-09-08 [1] RSPM
glue 1.8.0 2024-09-30 [1] RSPM
gridExtra 2.3 2017-09-09 [1] RSPM
gtable 0.3.6 2024-10-25 [1] RSPM
gtools 3.9.5 2023-11-20 [1] RSPM
htmltools 0.5.9 2025-12-04 [1] RSPM
htmlwidgets 1.6.4 2023-12-06 [1] RSPM
httpuv 1.6.16 2025-04-16 [1] RSPM (R 4.5.0)
httr2 1.2.2 2025-12-08 [1] RSPM
igraph 2.2.2 2026-02-12 [1] RSPM
inline 0.3.21 2025-01-09 [1] RSPM
insight 1.4.6 2026-02-04 [1] RSPM
jsonlite 2.0.0 2025-03-27 [1] RSPM (R 4.5.0)
knitr 1.51 2025-12-20 [1] RSPM
later 1.4.6 2026-02-13 [1] RSPM
lattice 0.22-9 2026-02-09 [1] RSPM
lifecycle 1.0.5 2026-01-08 [1] RSPM (R 4.5.0)
lme4 1.1-38 2025-12-02 [1] RSPM
loo 2.9.0 2025-12-23 [1] RSPM (R 4.5.0)
magrittr 2.0.4 2025-09-12 [1] RSPM (R 4.5.0)
markdown 2.0 2025-03-23 [1] RSPM (R 4.5.0)
MASS 7.3-65 2025-02-28 [2] CRAN (R 4.5.0)
Matrix 1.7-4 2025-08-28 [1] RSPM
matrixStats 1.5.0 2025-01-07 [1] RSPM
memoise 2.0.1 2021-11-26 [1] RSPM
mime 0.13 2025-03-17 [1] RSPM
miniUI 0.1.2 2025-04-17 [1] RSPM (R 4.5.0)
minqa 1.2.8 2024-08-17 [1] RSPM
mvtnorm 1.3-3 2025-01-10 [1] RSPM
nlme 3.1-168 2025-03-31 [2] CRAN (R 4.5.0)
nloptr 2.2.1 2025-03-17 [1] RSPM (R 4.5.0)
openssl 2.3.4 2025-09-30 [1] RSPM (R 4.5.0)
otel 0.2.0 2025-08-29 [1] RSPM (R 4.5.0)
pillar 1.11.1 2025-09-17 [1] RSPM (R 4.5.0)
pkgbuild 1.4.8 2025-05-26 [1] RSPM (R 4.5.0)
pkgconfig 2.0.3 2019-09-22 [1] RSPM
pkgload 1.5.0 2026-02-03 [1] RSPM
plyr 1.8.9 2023-10-02 [1] RSPM
posterior 1.6.1 2025-02-27 [1] RSPM (R 4.5.0)
prettyunits 1.2.0 2023-09-24 [1] RSPM
processx 3.8.6 2025-02-21 [1] RSPM
promises 1.5.0 2025-11-01 [1] RSPM (R 4.5.0)
ps 1.9.1 2025-04-12 [1] CRAN (R 4.5.0)
purrr 1.2.1 2026-01-09 [1] RSPM (R 4.5.0)
QuickJSR 1.9.0 2026-01-25 [1] RSPM
R6 2.6.1 2025-02-15 [1] RSPM
rappdirs 0.3.4 2026-01-17 [1] RSPM
rbibutils 2.4.1 2026-01-21 [1] RSPM
rcmdcheck 1.4.0 2021-09-27 [1] RSPM
RColorBrewer 1.1-3 2022-04-03 [1] RSPM
Rcpp 1.1.1 2026-01-10 [1] RSPM (R 4.5.0)
RcppParallel 5.1.11-1 2025-08-27 [1] RSPM (R 4.5.0)
Rdpack 2.6.6 2026-02-08 [1] RSPM
reformulas 0.4.4 2026-02-02 [1] RSPM
remotes 2.5.0.9000 2025-10-11 [1] Github (r-lib/remotes@bcd35d5)
reshape2 1.4.5 2025-11-12 [1] RSPM (R 4.5.0)
rlang 1.1.7.9000 2026-03-01 [1] Github (r-lib/rlang@74733f3)
roxygen2 7.3.3.9000 2026-03-10 [1] Github (r-lib/roxygen2@0fd17e6)
rprojroot 2.1.1 2025-08-26 [1] RSPM (R 4.5.0)
rstan 2.32.7 2025-03-10 [1] RSPM
rstanarm 2.32.2 2025-09-30 [1] RSPM (R 4.5.0)
rstantools 2.6.0 2026-01-10 [1] RSPM (R 4.5.0)
rstudioapi 0.18.0 2026-01-16 [1] RSPM (R 4.5.0)
S7 0.2.1 2025-11-14 [1] RSPM
scales 1.4.0 2025-04-24 [1] RSPM
sessioninfo 1.2.3 2025-02-05 [1] RSPM
shiny 1.12.1 2025-12-09 [1] RSPM
shinyjs 2.1.1 2026-01-15 [1] RSPM (R 4.5.0)
shinystan 2.7.0 2025-12-12 [1] RSPM
shinythemes 1.2.0 2021-01-25 [1] RSPM
StanHeaders 2.32.10 2024-07-15 [1] RSPM
statmod 1.5.1 2025-10-09 [1] RSPM
stringi 1.8.7 2025-03-27 [1] RSPM
stringr 1.6.0 2025-11-04 [1] RSPM (R 4.5.0)
survival 3.8-6 2026-01-16 [1] RSPM
sys 3.4.3 2024-10-04 [1] RSPM
tensorA 0.36.2.1 2023-12-13 [1] RSPM
R test.snapshot.ci * 0.17.0.2 [?]
testthat * 3.3.2 2026-01-11 [1] RSPM
threejs 0.3.4 2025-04-21 [1] RSPM (R 4.5.0)
tibble 3.3.1 2026-01-11 [1] RSPM (R 4.5.0)
tidyselect 1.2.1 2024-03-11 [1] RSPM
tweedie 3.0.14 2026-02-16 [1] RSPM (R 4.5.0)
usethis 3.2.1 2025-09-06 [1] RSPM (R 4.5.0)
V8 8.0.1 2025-10-10 [1] RSPM (R 4.5.0)
vctrs 0.7.1 2026-01-23 [1] RSPM
waldo 0.6.2 2025-07-11 [1] RSPM
whisker 0.4.1 2022-12-05 [1] RSPM
withr 3.0.2 2024-10-28 [1] RSPM
xfun 0.56 2026-01-18 [1] RSPM
xml2 1.5.2 2026-01-17 [1] RSPM
xopen 1.0.1 2024-04-25 [1] RSPM
xtable 1.8-4 2019-04-21 [1] RSPM
xts 0.14.1 2024-10-15 [1] RSPM
zoo 1.8-15 2025-12-15 [1] RSPM

[1] /home/etienne/R/x86_64-pc-linux-gnu-library/4.5
[2] /opt/R/4.5.0/lib/R/library

  • ── Packages attached to the search path.
    V ── Loaded and on-disk version mismatch.
    P ── Loaded and on-disk path mismatch.
    R ── Package was removed from disk.

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