Skip to content

Commit eb21bfa

Browse files
committed
Some notes on snapshot cleanup
Fixes #1615
1 parent 2e911f4 commit eb21bfa

File tree

5 files changed

+21
-3
lines changed

5 files changed

+21
-3
lines changed

β€ŽR/snapshot.Rβ€Ž

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@
5353
#' carefully think about your testing strategy to ensure that all important
5454
#' variants are covered by automated tests, and ensure that you have a way
5555
#' to get snapshot changes out of your CI system and back into the repo.
56+
#'
57+
#' Note that there's no way to declare all possible variants up front which
58+
#' means that as soon as you start using variants, you, not testthat, is
59+
#' responsible for cleaning up old snapshots.
5660
#' @param transform Optionally, a function to scrub sensitive or stochastic
5761
#' text from the output. Should take a character vector of lines as input
5862
#' and return a modified character vector as output.

β€Žman/expect_snapshot.Rdβ€Ž

Lines changed: 5 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

β€Žman/expect_snapshot_output.Rdβ€Ž

Lines changed: 5 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

β€Žman/expect_snapshot_value.Rdβ€Ž

Lines changed: 5 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

β€Žvignettes/snapshotting.Rmdβ€Ž

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,8 @@ test_that("bullets", {
128128
If this is a deliberate change, you can follow the advice in the message and update the snapshots for that file by running `snapshot_accept("pizza")`; otherwise you can fix the bug and your tests will pass once more.
129129
(You can also accept snapshot for all files with `snapshot_accept()`).
130130

131+
If you delete the test, the corresponding snapshot will be remove the next time you run the tests. If you delete all snapshots in the file, the entire snapshot file will be deleted the next time you run all the tests.
132+
131133
### Snapshot format
132134

133135
Snapshots are recorded using a subset of markdown.

0 commit comments

Comments
Β (0)