-
Notifications
You must be signed in to change notification settings - Fork 321
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prevent snapshot cleanup #1481
Comments
Do you have an example you could point me to? I think you might be able to use variants to help with this. |
Ok, the root problem is coming back to me — when you run if (run_snaps()) {
expect_snapshot_file(path, name = "foo")
} else {
announce_file_snapshot(name = "foo")
skip("Snaps off")
} This is obviously a bit clunky, but you could wrap up into a helper: my_expect_snapshot_file <- function(path, name = basename(path), ...) {
if (run_snaps()) {
expect_snapshot_file(path, name = name, ...)
} else {
announce_file_snapshot(name = name)
skip("Snaps off")
}
} It's possible that testthat could do more here, but I'm not sure what, and hopefully this code helps a little. |
I have a similar issue with skipped test. When I do test offline, I do not want the online-only snapshots to disappear. |
Hello,
I have quite a lot of tests relying on
vdiffr
, which recently started using snapshots. Which tests are executed is pre-determined by a shell environment variable. However, this conditional system doesn't play nicely anymore with the automatic cleaning of 'unused' snapshot files, as all the reference snapshots from tests not being executed are removed. I wondered if there is a way to prevent activation of the automatic cleaning system?Thanks,
Rick
The text was updated successfully, but these errors were encountered: