@@ -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+
127149test_that(" quarto_available()" , {
128150 expect_error(
129151 quarto_available(" 1.5" , " 1.4" ),
0 commit comments