diff --git a/R/utils.R b/R/utils.R index f29c837d..37273174 100644 --- a/R/utils.R +++ b/R/utils.R @@ -69,7 +69,7 @@ write_if_different <- function(path, contents, command = NULL, check = TRUE) { name <- basename(path) if (check && !made_by_roxygen(path)) { cli::cli_inform(c( - x = "Skipping {.path {name}}", + x = "Skipping {.href [{name}](file://{path})}", i = "It already exists and was not generated by {.pkg roxygen2}." )) return(FALSE) diff --git a/tests/testthat/_snaps/utils.md b/tests/testthat/_snaps/utils.md index 00ed6605..5d124fbf 100644 --- a/tests/testthat/_snaps/utils.md +++ b/tests/testthat/_snaps/utils.md @@ -12,7 +12,7 @@ Code write_if_different(path, "a <- 2") Message - x Skipping 'test.R' + x Skipping test.R () i It already exists and was not generated by roxygen2. Output [1] FALSE diff --git a/tests/testthat/test-utils.R b/tests/testthat/test-utils.R index 44558386..b3d3ed13 100644 --- a/tests/testthat/test-utils.R +++ b/tests/testthat/test-utils.R @@ -22,7 +22,11 @@ test_that("write_if_different produces informative messages", { expect_snapshot(write_if_different(path, "a <- 2")) write_lines("a <- 1", path) - expect_snapshot(write_if_different(path, "a <- 2")) + # strip temp path + expect_snapshot( + write_if_different(path, "a <- 2"), + transform = function(x) gsub(dir, "", x, fixed = TRUE) + ) path <- file.path(dir, "+.R") expect_snapshot(write_if_different(path, "a <- 2"))