Skip to content

Commit ced558a

Browse files
committed
add a full regex fallbak for specific windows path in stack trace
1 parent d221ee0 commit ced558a

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

tests/testthat/helper.R

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,6 @@ transform_quarto_cli_in_output <- function(
158158
# look for normalized path
159159
lines <- hide_path(lines, quarto_found_normalized)
160160

161-
# look for specific non-symlink path from Quarto CLI output
162161
non_normalized_path <- quarto_path(normalize = FALSE)
163162
non_normalized_path_slash <- gsub("\\\\", "/", non_normalized_path)
164163
lines <- hide_path(lines, non_normalized_path)
@@ -184,6 +183,16 @@ transform_quarto_cli_in_output <- function(
184183
# it will be quarto.exe only on windows
185184
lines <- gsub("quarto\\.(exe|cmd)", "quarto", lines)
186185
}
186+
187+
# fallback: Above can fail on some windows situation, so try a regex match
188+
# it should only match windows path with Drive letters
189+
lines <- gsub(
190+
"file:[/]{2,3}[A-Za-z]:[\\\\/](?:[^:\\n]+[\\\\/])*bin[\\\\/]quarto\\.js:\\d+:\\d+",
191+
"<quarto.js full path with location>",
192+
lines,
193+
perl = TRUE
194+
)
195+
187196
if (version) {
188197
lines <- gsub(quarto_version(), "<quarto version>", lines, fixed = TRUE)
189198
}

0 commit comments

Comments
 (0)