x
|
An R object to snapshot. Can be any R object including lists, models, data.frames, vectors, etc.
|
name
|
character snapshot name (file extension added automatically)
|
writer
|
function Function to write the object to a file. Default is save_rds(). Other options include save_json(), save_deparse(), save_csv(). Custom writer functions should accept x and return a file path.
|
print
|
logical whether to print waldo::compare output to R console; can become very long for complex objects like lms
|
tolerance
|
If non-NULL, used as threshold for ignoring small floating point differences when comparing numeric vectors. Only applies when writer produces an RDS file (the default); silently ignored for text-based formats (JSON, CSV, deparse, etc.). See waldo::compare() for full details.
|
…
|
Arguments passed on to testthat::expect_snapshot_file
-
binary
-
Please use the compare argument instead.
-
cran
-
Should these expectations be verified on CRAN? By default, they are not, because snapshot tests tend to be fragile because they often rely on minor details of dependencies.
-
transform
-
Optionally, a function to scrub sensitive or stochastic text from the output. Should take a character vector of lines as input and return a modified character vector as output.
-
variant
-
If not-NULL, results will be saved in _snaps/{variant}/{test}/{name}. This allows you to create different snapshots for different scenarios, like different operating systems or different R versions.
Note that there’s no way to declare all possible variants up front which means that as soon as you start using variants, you are responsible for deleting snapshot variants that are no longer used. (testthat will still delete all variants if you delete the test.)
-
old,new
-
Paths to old and new snapshot files.
|