Repository navigation
Keep test snapshots in the package R CMD check tests - #128
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
Two moderate active findings remain because the short R-CMD-check workflow lacks the snapshot-preparation step and can still fail missing-snapshot checks.
2 open issues
What changed in this PR
This PR updates reusable R CMD check workflows so test snapshots remain in the temporary package build used by CI, preventing missing-snapshot failures caused by .Rbuildignore.
Changes:
- Removes
.Rbuildignoreentries containing_snapsin the CI checkout. - Applies the workaround before
check-r-packagein four R CMD check workflows. - Leaves repository and CRAN package source files unchanged.
- The short R CMD check workflow remains without this workaround.
| File | Description |
|---|---|
| .github/workflows/R-CMD-check.yaml | Keeps test snapshots in standard cross-platform R CMD checks by removing their .Rbuildignore exclusions in the CI checkout. |
| .github/workflows/R-CMD-check-no-oldrel.yaml | Keeps test snapshots in R CMD checks without older R versions by removing their .Rbuildignore exclusions in the CI checkout. |
| .github/workflows/R-CMD-check-main.yaml | Keeps test snapshots in main-branch R CMD checks by removing their .Rbuildignore exclusions in the CI checkout. |
| .github/workflows/R-CMD-check-hard.yaml | Keeps test snapshots in hard-dependency R CMD checks by removing their .Rbuildignore exclusions in the CI checkout. |
Review effort: Lite
|
I left |
|
There are some merge conflicts. |
# Conflicts: # .github/workflows/R-CMD-check-main.yaml # .github/workflows/R-CMD-check-no-oldrel.yaml # .github/workflows/R-CMD-check.yaml
|
Fixed. I merged main in. #126 had added its rstan step at the same spot, so the snapshot step now comes right after it, just before |

Closes #88.
Since testthat 3.3.0, a snapshot test with no saved snapshot fails on CI by default. Most of our packages have
^tests/testthat/_snaps/.in.Rbuildignore, so R CMD check tests the package without its snapshots and every snapshot test fails as new.This adds a step before
check-r-packageinR-CMD-check.yaml,R-CMD-check-main.yaml,R-CMD-check-no-oldrel.yamlandR-CMD-check-hard.yaml. The step deletes the_snapslines from.Rbuildignore, but only in the CI checkout, so the CRAN packages don't change.I pointed performance's and modelbased's callers at this branch from test branches on my forks. Test failures went from 46 to 3–4 in performance and from about 245 to 17 in modelbased, and performance's R-CMD-check-hard passes:
https://github.com/jmgirard/performance/actions/runs/46670228145
https://github.com/jmgirard/performance/actions/runs/46670222439
https://github.com/jmgirard/modelbased/actions/runs/46670237171
The packages need to fix what's left. performance has one test with no saved snapshot (
test-model_performance.rma.R:59), and a few modelbased snapshots, mostly intest-print.R, don't match now that they're actually compared. The other failures aren't about snapshots: mice 3.20.0, the Windows brms error that #126 fixes, and some that fail on main too.