ITADN

feat: Disable new snapshot error

#2320Openschloerke 创建于 2026-02-03
S
schloerkecommented
https://github.com/r-lib/testthat/pull/2149 added new feature: > * `expect_snapshot()` and friends will now fail when creating a new snapshot on CI. This is usually a signal that you've forgotten to run it locally before committing (#1461). ---------------------- This is problematic for packages with **many** snapshots. Situation: * Package has many visual snapshot tests * Many snaps cause package to be larger than 5mb * These snaps a _never_ used within revdep checks Previous solution: * R build Ignore the `tests/testthat/_snaps` folder. Nothing is sent to CRAN and nothing is tested on CI. Local testing performs full snapshot testing. ---------------------- Proposal: * The default value of `fail_on_new` should be determined by the existence of the `_snaps` folder: `fail_on_new = fs::dir_exists(here::here("tests/testthat/_snaps"))` * Behavior: * If **no snaps** exist during testing, do not fail on new snaps (new behavior) * else fail then any new snap should cause a CI failure (current behavior)
3 条评论