Skip to content

Commit 658fca6

Browse files
committed
Add test
1 parent ae7051b commit 658fca6

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

tests/testthat/test-snapshot-reporter.R

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,17 @@ test_that("basic workflow", {
3838
expect_true(file.exists(file.path(path, "snapshot-2.new.md")))
3939
})
4040

41+
test_that("defaults to failing on CI", {
42+
withr::local_envvar(CI = "true")
43+
44+
path <- withr::local_tempdir()
45+
snapper <- local_snapshotter(path)
46+
snapper$start_file("snapshot-2")
47+
# warns on first creation
48+
snapper$start_file("snapshot-2", "test")
49+
expect_error(expect_snapshot_output("x"), "Adding new")
50+
})
51+
4152
test_that("only create new files for changed variants", {
4253
snapper <- local_snapshotter(fail_on_new = FALSE)
4354
snapper$start_file("variants", "test")

0 commit comments

Comments
 (0)