-
Notifications
You must be signed in to change notification settings - Fork 340
Closed
Labels
bugan unexpected problem or unintended behavioran unexpected problem or unintended behaviorsnapshot π·
Description
Moving this conversation here: posit-dev/positron#6580 (comment)
You can grab this toy package where I've been exercising various things when I work on Positron's test explorer: https://github.com/jennybc/testfun
(For the record, I'm writing this when testfun's main is at 8d84efc, just in case it evolves before running this reprex.)
Run an individual test file with 3 snapshot tests:
> test_file("tests/testthat/test-snapshots.R")
ββ Testing test-snapshots.R βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
[ FAIL 0 | WARN 0 | SKIP 0 | PASS 3 ] Done!
All is well. All tests are passing. All snapshots are there.
Now run just one of those snapshot tests (which is ultimately what Positron's test explorer lets users do with various UI gestures):
> test_file("tests/testthat/test-snapshots.R", desc = "snapshot test 2")
ββ Testing test-snapshots.R βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
[ FAIL 0 | WARN 0 | SKIP 0 | PASS 1 ] Done!
All seems well. But the git diff shows that the snapshot file has changed and snapshots 1 and 3 have gone missing. You can see this also by re-running the whole file:
> test_file("tests/testthat/test-snapshots.R")
ββ Testing test-snapshots.R βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
[ FAIL 0 | WARN 2 | SKIP 0 | PASS 3 ]
ββ Warning (test-snapshots.R:2:3): snapshot test 1 ββββββββββββββββββββββββββββββββ
Adding new snapshot:
Code
# first snapshot
ββ Warning (test-snapshots.R:10:3): snapshot test 3 βββββββββββββββββββββββββββββββ
Adding new snapshot:
Code
# third snapshot
[ FAIL 0 | WARN 2 | SKIP 0 | PASS 3 ]
Metadata
Metadata
Assignees
Labels
bugan unexpected problem or unintended behavioran unexpected problem or unintended behaviorsnapshot π·