Skip to content

Commit

Permalink
Hide version number in message for snapshot
Browse files Browse the repository at this point in the history
  • Loading branch information
cderv committed Feb 1, 2024
1 parent 384633a commit 378aa59
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion tests/testthat/_snaps/before-1-4/create.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
Condition
Error in `check_quarto_version()`:
! `quarto create project` has been added in Quarto 1.4. See <https://quarto.org/docs/projects/quarto-projects.html>.
i You are using 1.3.433 from '<quarto full path>'.
i You are using <quarto version> from '<quarto full path>'.

13 changes: 8 additions & 5 deletions tests/testthat/helper.R
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ expect_snapshot_qmd_output <- function(name, input, output_file = NULL, ...) {
}


transform_quarto_cli_in_output <- function(full_path = FALSE, normalize_path = FALSE) {
transform_quarto_cli_in_output <- function(full_path = FALSE, normalize_path = FALSE, version = FALSE) {
return(
function(lines) {
if (full_path) {
Expand All @@ -82,11 +82,14 @@ transform_quarto_cli_in_output <- function(full_path = FALSE, normalize_path = F
lines <- gsub(quarto_found, "<quarto full path>", lines, fixed = TRUE)
# seems like there are quotes around path in CI windows
lines <- gsub("\"<quarto full path>\"", "<quarto full path>", lines, fixed = TRUE)
return(lines)
} else {
# it will be quarto.exe only on windows
lines <- gsub("quarto\\.(exe|cmd)", "quarto", lines)
}

# it will be quarto.exe only on windows
gsub("quarto\\.(exe|cmd)", "quarto", lines)
if (version) {
lines <- gsub(quarto_version(), "<quarto version>", lines, fixed = TRUE)
}
return(lines)
}
)
}
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-create.R
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ test_that("create project only available for 1.4", {
expect_snapshot(
error = TRUE,
quarto_create_project(name = "test"),
transform = transform_quarto_cli_in_output(full_path = TRUE),
transform = transform_quarto_cli_in_output(full_path = TRUE, version = TRUE),
variant = "before-1-4"
)
})

0 comments on commit 378aa59

Please sign in to comment.