Skip to content

Commit 7885339

Browse files
committed
Tweak test
1 parent d69af0c commit 7885339

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

tests/testthat/test-render.R

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,16 +61,26 @@ test_that("quarto_args in quarto_render", {
6161
})
6262

6363
test_that("`quarto_render(as_job = TRUE)` is wrapable", {
64-
skip_if(is.null(quarto_path()))
64+
# this tests background jobs, a feature only available in interactive RStudio IDE sesssions
65+
skip_on_cran()
66+
skip_if_no_quarto()
6567
skip_if_not(rstudioapi::isAvailable())
66-
skip_if_not_installed("rprojroot")
67-
dir <- rprojroot::find_testthat_root_file()
68-
input <- file.path(dir, "test.Rmd")
69-
output <- file.path(dir, "test.html")
70-
wrapper <- function(path) quarto_render(path, quiet = TRUE, as_job = TRUE)
71-
wrapper(input)
68+
qmd <- local_qmd_file(c("content"))
69+
withr::local_dir(dirname(qmd))
70+
output <- basename(
71+
withr::local_file(xfun::with_ext(qmd, ".native"))
72+
)
73+
wrapper <- function(path, out, format) {
74+
quarto_render(
75+
input = path,
76+
output_file = out,
77+
output_format = format,
78+
quiet = TRUE,
79+
as_job = TRUE
80+
)
81+
}
82+
wrapper(basename(qmd), output, "native")
7283
# wait for background job to finish (10s should be conservative enough)
7384
Sys.sleep(10)
7485
expect_true(file.exists(output))
75-
unlink(output)
7686
})

0 commit comments

Comments
 (0)