-
Notifications
You must be signed in to change notification settings - Fork 342
Closed
Labels
bugan unexpected problem or unintended behavioran unexpected problem or unintended behaviorsnapshot π·
Milestone
Description
First half is with a variant. Second half is with no variant.
Both are failing to find any snaps to review.
Reprex:
library(testthat)
dir <- withr::local_tempdir()
#> Setting deferred event(s) on global environment.
#> * Will be run automatically when session ends
#> * Execute (and clear) with `withr::deferred_run()`.
#> * Clear (without executing) with `withr::deferred_clear()`.
snapper <- testthat:::local_snapshotter(dir)
snapper$start_file("test", "test")
test_that("test", {
local_edition(3)
expect_snapshot_value("a", variant = "barret")
})
#> ββ Warning (<text>:8:3): test ββββββββββββββββββββββββββββββββββββββββββββββββββ
#> Adding new snapshot to variant 'barret':
#> "a"
snapper$end_file()
dir(dir, recursive = TRUE)
#> [1] "barret/test.md"
snapper$start_file("test", "test")
test_that("test", {
local_edition(3)
expect_snapshot_value("b", variant = "barret")
})
#> ββ Failure (<text>:16:3): test βββββββββββββββββββββββββββββββββββββββββββββββββ
#> Snapshot of "b" has changed:
#> `old`: "a"
#> `new`: "b"
#>
#> * Run `snapshot_accept('barret/test')` to accept the change
#> * Run `snapshot_review('barret/test')` to interactively review the change
#> Error:
#> ! Test failed
snapper$end_file()
dir(dir, recursive = TRUE)
#> [1] "barret/test.md" "barret/test.new.md"
## Should review the "barret" snaps, but currently does not
snapshot_review("barret/test")
#> No snapshots to update
snapshot_review("barret/test", path = dir)
#> No snapshots to update
snapper$start_file("test", "test")
test_that("test", {
local_edition(3)
expect_snapshot_value("a", variant = NULL)
})
#> ββ Warning (<text>:33:3): test βββββββββββββββββββββββββββββββββββββββββββββββββ
#> Adding new snapshot:
#> "a"
snapper$end_file()
dir(dir, recursive = TRUE)
#> [1] "barret/test.md" "barret/test.new.md" "test.md"
snapper$start_file("test", "test")
test_that("test", {
local_edition(3)
expect_snapshot_value("b", variant = NULL)
})
#> ββ Failure (<text>:41:3): test βββββββββββββββββββββββββββββββββββββββββββββββββ
#> Snapshot of "b" has changed:
#> `old`: "a"
#> `new`: "b"
#>
#> * Run `snapshot_accept('test')` to accept the change
#> * Run `snapshot_review('test')` to interactively review the change
#> Error:
#> ! Test failed
snapper$end_file()
dir(dir, recursive = TRUE)
#> [1] "barret/test.md" "barret/test.new.md" "test.md"
#> [4] "test.new.md"
## Should also review the non-variant "test" snaps, but currently does not
snapshot_review("test")
#> No snapshots to update
snapshot_review("test", path = dir)
#> No snapshots to updateCreated on 2022-01-07 by the reprex package (v2.0.0)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugan unexpected problem or unintended behavioran unexpected problem or unintended behaviorsnapshot π·