Skip to content

Commit 12f12f0

Browse files
committed
Consistent tracae env usage
1 parent a701f8b commit 12f12f0

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

R/expect-length.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ expect_length <- function(object, n) {
2121

2222
if (act$n != n) {
2323
msg <- sprintf("%s has length %i, not length %i.", act$lab, act$n, n)
24-
return(fail(msg, trace_env = parent.frame()))
24+
return(fail(msg))
2525
}
2626
pass(act$val)
2727
}

R/snapshot-file.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ snapshot_file_equal <- function(
191191
path,
192192
file_equal = compare_file_binary,
193193
fail_on_new = FALSE,
194-
trace_env = NULL
194+
trace_env = caller_env()
195195
) {
196196
if (!file.exists(path)) {
197197
abort(paste0("`", path, "` not found"))

R/snapshot-reporter.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ SnapshotReporter <- R6::R6Class(
4848
...,
4949
tolerance = testthat_tolerance(),
5050
variant = NULL,
51-
trace_env = NULL
51+
trace_env = caller_env()
5252
) {
5353
check_string(self$test, allow_empty = FALSE)
5454
i <- self$new_snaps$append(self$test, variant, save(value))
@@ -102,7 +102,7 @@ SnapshotReporter <- R6::R6Class(
102102
path,
103103
file_equal,
104104
variant = NULL,
105-
trace_env = NULL
105+
trace_env = caller_env()
106106
) {
107107
self$announce_file_snapshot(name)
108108

0 commit comments

Comments
 (0)