A convenience wrapper around testthat::expect_snapshot() and
expect_pkg_error_classes() that captures both the error class hierarchy and
the user-facing message in a single snapshot.
Usage
expect_pkg_error_snapshot(
object,
package,
...,
transform = NULL,
variant = NULL,
env = caller_env()
)Arguments
- object
An expression that is expected to throw an error.
- package
(length-1 character)The name of the package to use in classes.- ...
(character)Components of the class name, from least-specific to most.- transform
(
functionorNULL) Optional function to scrub volatile output (e.g. temp paths) before snapshot comparison. Passed through totestthat::expect_snapshot().- variant
(
character(1)orNULL) Optional snapshot variant name. Passed through totestthat::expect_snapshot().- env
(
environment) The environment in whichobjectshould be evaluated. The actual evaluation will occur in a child of this environment, withexpect_pkg_error_classes()available even if this package is not attached.
Value
The result of testthat::expect_snapshot(), invisibly.