Skip to content

Commit 86ead03

Browse files
committed
reformat using air
1 parent ed1daab commit 86ead03

File tree

2 files changed

+25
-3
lines changed

2 files changed

+25
-3
lines changed

R/render.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@
5151
#' advanced usage and useful for CLI arguments which are not yet mirrored in a
5252
#' dedicated parameter of this \R function. See `quarto render --help` for options.
5353
#' @param pandoc_args Additional command line arguments to pass on to Pandoc.
54-
#' @param libpaths A character vector of library paths to use for the R session run by Quarto.
55-
#' If `NULL`, no library paths will be pass to quarto subprocess and defaults R one will be used.
56-
#' Setting `options(quarto.use_libpaths = FALSE)` will disable this behavior and
54+
#' @param libpaths A character vector of library paths to use for the R session run by Quarto.
55+
#' If `NULL`, no library paths will be pass to quarto subprocess and defaults R one will be used.
56+
#' Setting `options(quarto.use_libpaths = FALSE)` will disable this behavior and
5757
#' never pass library paths to quarto subprocess.
5858
#' @param as_job Render as an RStudio background job. Default is `"auto"`,
5959
#' which will render individual documents normally and projects as

tests/testthat/test-quarto.R

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,28 @@ test_that("quarto.quiet options controls echo and overwrite function argument",
124124
})
125125
})
126126

127+
test_that("quarto sees same libpaths as main process", {
128+
skip_if_no_quarto()
129+
skip_on_cran()
130+
qmd <- local_qmd_file(c("```{r}", "#| echo: false", ".libPaths()", "```"))
131+
tmp_lib <- withr::local_tempdir("tmp_libpath")
132+
withr::local_libpaths(tmp_lib, action = "prefix")
133+
withr::local_dir(dirname(qmd))
134+
out <- "out.md"
135+
# .libPaths() is known in Quarto render
136+
out <- .render_and_read(qmd, output_format = "gfm")
137+
expect_match(out, basename(tmp_lib), all = FALSE, fixed = TRUE)
138+
# Opting-out globally
139+
withr::with_options(
140+
list(quarto.use_libpaths = FALSE),
141+
out <- .render_and_read(qmd, output_format = "gfm")
142+
)
143+
expect_no_match(out, basename(tmp_lib), fixed = TRUE)
144+
# Opting-out at command
145+
out <- .render_and_read(qmd, output_format = "gfm", libpaths = NULL)
146+
expect_no_match(out, basename(tmp_lib), fixed = TRUE)
147+
})
148+
127149
test_that("quarto_available()", {
128150
expect_error(
129151
quarto_available("1.5", "1.4"),

0 commit comments

Comments
 (0)