Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions R/snapshot.R
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@
#' carefully think about your testing strategy to ensure that all important
#' variants are covered by automated tests, and ensure that you have a way
#' to get snapshot changes out of your CI system and back into the repo.
#'
#' Note that there's no way to declare all possible variants up front which
#' means that as soon as you start using variants, you, not testthat, is
#' responsible for cleaning up old snapshots.
#' @param transform Optionally, a function to scrub sensitive or stochastic
#' text from the output. Should take a character vector of lines as input
#' and return a modified character vector as output.
Expand Down
6 changes: 5 additions & 1 deletion man/expect_snapshot.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion man/expect_snapshot_output.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion man/expect_snapshot_value.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions vignettes/snapshotting.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@ test_that("bullets", {
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.
(You can also accept snapshot for all files with `snapshot_accept()`).

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.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Except when variants are used, right?
This is what I understood from the clarification in snapshot.R help addition.

In that case, the user is responsible for cleaning old, unused variants snapshot.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you delete the entire test, then all the variants will be cleaned up. But testthat can't know if only one variant is never exercised any more, so it will never delete a single variant.


### Snapshot format

Snapshots are recorded using a subset of markdown.
Expand Down
Loading