Skip to content

Commit 2aa0829

Browse files
committed
Add partial support for any snapshot extension.
Well, this still assumes that there is just one extension being used among all snapshot files.
1 parent 349561e commit 2aa0829

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

R/snapshot-manage.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ review_app <- function(name, old_path, new_path) {
129129
snapshot_meta <- function(files = NULL, path = "tests/testthat") {
130130
all <- dir(file.path(path, "_snaps"), recursive = TRUE, full.names = TRUE)
131131
cur <- all[!grepl("\\.new\\.", all)]
132+
ext <- unique(tools::file_ext(cur))
132133

133134
snap_file <- basename(dirname(cur)) != "_snaps"
134135
snap_test <- ifelse(snap_file, basename(dirname(cur)), gsub("\\.md$", "", basename(cur)))
@@ -161,7 +162,7 @@ snapshot_meta <- function(files = NULL, path = "tests/testthat") {
161162
files <- files[!is_dir]
162163

163164
dirs <- substr(dirs, 1, nchar(dirs) - 1)
164-
files <- gsub("\\.md|\\.txt$", "", files)
165+
files <- gsub(paste0("\\.", ext), "", files)
165166

166167
out_name_sans_ext <- tools::file_path_sans_ext(out$name)
167168
out <- out[out_name_sans_ext %in% files |

0 commit comments

Comments
 (0)