-
Notifications
You must be signed in to change notification settings - Fork 340
Closed
Description
None of my tests use snapshots. The initial state of my testthat directory is that there is no _snaps subdirectory.
When I run devtools::test() I can see that the _snaps folder is created and then removed during the testing process.
When I run devtools::test() with the filter argument to run a subset of tests, the _snaps folder is created but not removed.
To reproduce, clone the latest version of this testthat repo, open testthat.Rproj, and step through the following code:
# setup paths
snaps_path <- file.path('tests', 'testthat', '_snaps')
snaps_backup_path <- file.path('tests', 'testthat', '_snaps_backup')
# backup existing _snaps folder
file.rename(snaps_path, snaps_backup_path)
#[1] TRUE
# _snaps folder doesn't exist now
file.exists(snaps_path)
#[1] FALSE
# these tests contain no snapshots
devtools::test(filter = '^bare$')
#βΉ Testing testthat
#Starting 1 test process
#β | F W S OK | Context
#β | 4 | bare
#
#ββ Results
#Duration: 2.3 s
#[ FAIL 0 | WARN 0 | SKIP 0 | PASS 4 ]
# _snaps folder got created
file.exists(snaps_path)
#[1] TRUE
# restore existing _snaps folder
unlink(snaps_path, recursive = TRUE)
file.rename(snaps_backup_path, snaps_path)
#[1] TRUE
See also:
Metadata
Metadata
Assignees
Labels
No labels