diff --git a/tests/testthat/_snaps/build-articles.md b/tests/testthat/_snaps/build-articles.md
index 11dc946de..b936cb056 100644
--- a/tests/testthat/_snaps/build-articles.md
+++ b/tests/testthat/_snaps/build-articles.md
@@ -21,14 +21,6 @@
* kitten.jpg
* missing-images_files/figure-html/unnamed-chunk-1-1.png
-# articles don't include header-attrs.js script
-
- Code
- path <- build_article("standard", pkg)
- Message
- Reading vignettes/standard.Rmd
- Writing `articles/standard.html`
-
# can build article that uses html_vignette
Code
@@ -37,86 +29,14 @@
Reading vignettes/html-vignette.Rmd
Writing `articles/html-vignette.html`
-# can override html_document() options
-
- Code
- path <- build_article("html-document", pkg)
- Message
- Reading vignettes/html-document.Rmd
- Writing `articles/html-document.html`
-
-# html widgets get needed css/js
-
- Code
- path <- build_article("widget", pkg)
- Message
- Reading vignettes/widget.Rmd
- Writing `articles/widget.html`
-
-# can override options with _output.yml
-
- Code
- path <- build_article("html-document", pkg)
- Message
- Reading vignettes/html-document.Rmd
- Writing `articles/html-document.html`
-
-# can set width
-
- Code
- path <- build_article("width", pkg)
- Message
- Reading vignettes/width.Rmd
- Writing `articles/width.html`
-
-# finds external resources referenced by R code in the article html
-
- Code
- path <- build_article("resources", pkg)
- Message
- Reading vignettes/resources.Rmd
- Writing `articles/resources.html`
-
-# BS5 article laid out correctly with and without TOC
-
- Code
- toc_true_path <- build_article("standard", pkg)
- Message
- Reading vignettes/standard.Rmd
- Writing `articles/standard.html`
-
----
-
- Code
- toc_false_path <- build_article("toc-false", pkg)
- Message
- Reading vignettes/toc-false.Rmd
- Writing `articles/toc-false.html`
-
# articles in vignettes/articles/ are unnested into articles/
- Code
- path <- build_article("articles/nested", pkg)
- Message
- Reading vignettes/articles/nested.Rmd
- Writing `articles/nested.html`
-
----
-
Code
build_redirects(pkg)
Message
-- Building redirects ----------------------------------------------------------
Adding redirect from articles/articles/nested.html to articles/nested.html.
-# pkgdown deps are included only once in articles
-
- Code
- path <- build_article("html-deps", pkg)
- Message
- Reading vignettes/html-deps.Rmd
- Writing `articles/html-deps.html`
-
# warns about articles missing from index
Code
diff --git a/tests/testthat/_snaps/build-home-index.md b/tests/testthat/_snaps/build-home-index.md
index dd0af632f..833f84e7a 100644
--- a/tests/testthat/_snaps/build-home-index.md
+++ b/tests/testthat/_snaps/build-home-index.md
@@ -48,8 +48,12 @@
# data_home_sidebar() errors well when no HTML file
- home.sidebar.html specifies a file that doesn't exist ('file.html').
- i Edit _pkgdown.yml to fix the problem.
+ Code
+ data_home_sidebar(pkg)
+ Condition
+ Error:
+ ! home.sidebar.html specifies a file that doesn't exist ('file.html').
+ i Edit _pkgdown.yml to fix the problem.
# data_home_sidebar() can get a custom markdown formatted component
diff --git a/tests/testthat/_snaps/build-home.md b/tests/testthat/_snaps/build-home.md
deleted file mode 100644
index 48d42be6f..000000000
--- a/tests/testthat/_snaps/build-home.md
+++ /dev/null
@@ -1,41 +0,0 @@
-# intermediate files cleaned up automatically
-
- Code
- build_home(pkg)
- Message
- -- Building home ---------------------------------------------------------------
- Writing `authors.html`
- Writing `404.html`
-
----
-
- Code
- build_home(pkg)
- Message
- -- Building home ---------------------------------------------------------------
- Writing `authors.html`
- Writing `404.html`
-
-# can build site even if no Authors@R present
-
- Code
- build_home(pkg)
- Message
- -- Building home ---------------------------------------------------------------
- Writing `authors.html`
- Writing `404.html`
-
-# .github files are copied and linked
-
- Code
- build_home(pkg)
- Message
- -- Building home ---------------------------------------------------------------
- Writing `authors.html`
- Reading .github/404.md
- Writing `404.html`
- Reading .github/CODE_OF_CONDUCT.md
- Writing `CODE_OF_CONDUCT.html`
- Reading .github/SUPPORT.md
- Writing `SUPPORT.html`
-
diff --git a/tests/testthat/_snaps/build-logo.md b/tests/testthat/_snaps/build-logo.md
deleted file mode 100644
index 60cf0e1d8..000000000
--- a/tests/testthat/_snaps/build-logo.md
+++ /dev/null
@@ -1,7 +0,0 @@
-# can handle logo in subdir
-
- Code
- copy_logo(pkg)
- Message
- Copying man/figures/logo.svg to logo.svg
-
diff --git a/tests/testthat/_snaps/build-news.md b/tests/testthat/_snaps/build-news.md
index c91e9f9ab..fd8feae3f 100644
--- a/tests/testthat/_snaps/build-news.md
+++ b/tests/testthat/_snaps/build-news.md
@@ -55,15 +55,23 @@
# clear error for bad hierarchy - bad nesting
- Invalid NEWS.md: inconsistent use of section headings.
- i Top-level headings must be either all
or all .
- i See `?pkgdown::build_news()` for more details.
+ Code
+ data_news(temp_pkg)
+ Condition
+ Error:
+ ! Invalid NEWS.md: inconsistent use of section headings.
+ i Top-level headings must be either all or all .
+ i See `?pkgdown::build_news()` for more details.
# clear error for bad hierarchy - h3
- Invalid NEWS.md: inconsistent use of section headings.
- i Top-level headings must be either all or all .
- i See `?pkgdown::build_news()` for more details.
+ Code
+ data_news(temp_pkg)
+ Condition
+ Error:
+ ! Invalid NEWS.md: inconsistent use of section headings.
+ i Top-level headings must be either all or all .
+ i See `?pkgdown::build_news()` for more details.
# news can contain footnotes
diff --git a/tests/testthat/_snaps/build-reference-index.md b/tests/testthat/_snaps/build-reference-index.md
index 0563522fe..0ae76b448 100644
--- a/tests/testthat/_snaps/build-reference-index.md
+++ b/tests/testthat/_snaps/build-reference-index.md
@@ -57,8 +57,12 @@
# errors well when a content entry is empty
- Section "bla": contents 2 is empty.
- i Edit _pkgdown.yml to fix the problem.
+ Code
+ build_reference_index(pkg)
+ Condition
+ Error in `build_reference_index()`:
+ ! Section "bla": contents 2 is empty.
+ i Edit _pkgdown.yml to fix the problem.
# errors well when a content entry is not a character
diff --git a/tests/testthat/_snaps/build-reference.md b/tests/testthat/_snaps/build-reference.md
index 2bb006202..d15186d3e 100644
--- a/tests/testthat/_snaps/build-reference.md
+++ b/tests/testthat/_snaps/build-reference.md
@@ -13,36 +13,6 @@
! Failed to parse tag "\\url{}".
i Check for empty \url{} tags.
-# .Rd without usage doesn't get Usage section
-
- Code
- build_reference(pkg, topics = "e")
- Message
- -- Building function reference -------------------------------------------------
- Writing `reference/index.html`
- Reading man/e.Rd
- Writing `reference/e.html`
-
----
-
- Code
- build_reference(pkg, topics = "e")
- Message
- -- Building function reference -------------------------------------------------
- Writing `reference/index.html`
- Reading man/e.Rd
- Writing `reference/e.html`
-
-# pkgdown html dependencies are suppressed from examples in references
-
- Code
- build_reference(pkg, topics = "a")
- Message
- -- Building function reference -------------------------------------------------
- Writing `reference/index.html`
- Reading man/a.Rd
- Writing `reference/a.html`
-
# examples are reproducible by default, i.e. 'seed' is respected
Code
diff --git a/tests/testthat/_snaps/figure.md b/tests/testthat/_snaps/figure.md
deleted file mode 100644
index 2e7fbc508..000000000
--- a/tests/testthat/_snaps/figure.md
+++ /dev/null
@@ -1,20 +0,0 @@
-# can override defaults in _pkgdown.yml
-
- Code
- build_reference(pkg, devel = FALSE)
- Message
- -- Building function reference -------------------------------------------------
- Writing `reference/index.html`
- Reading man/figure.Rd
- Writing `reference/figure.html`
-
----
-
- Code
- build_articles(pkg)
- Message
- -- Building articles -----------------------------------------------------------
- Writing `articles/index.html`
- Reading vignettes/figures.Rmd
- Writing `articles/figures.html`
-
diff --git a/tests/testthat/_snaps/markdown.md b/tests/testthat/_snaps/markdown.md
index 6defdbc46..c80152bec 100644
--- a/tests/testthat/_snaps/markdown.md
+++ b/tests/testthat/_snaps/markdown.md
@@ -1,5 +1,9 @@
# markdown_text_inline() works with inline markdown
- must supply an inline element, not a block element.
- i Edit _pkgdown.yml to fix the problem.
+ Code
+ markdown_text_inline("x\n\ny", pkg = pkg)
+ Condition
+ Error:
+ ! must supply an inline element, not a block element.
+ i Edit _pkgdown.yml to fix the problem.
diff --git a/tests/testthat/_snaps/render.md b/tests/testthat/_snaps/render.md
index 97525bae9..5617d1ad3 100644
--- a/tests/testthat/_snaps/render.md
+++ b/tests/testthat/_snaps/render.md
@@ -1,14 +1,19 @@
# check_bslib_theme() works
- x Can't find Bootswatch/bslib theme preset "paper" (template.bootswatch).
- i Using Bootstrap version 4 (template.bootstrap).
- i Edit _pkgdown.yml to fix the problem.
-
----
-
- x Can't find Bootswatch/bslib theme preset "paper" (template and preset).
- i Using Bootstrap version 4 (template.bootstrap).
- i Edit _pkgdown.yml to fix the problem.
+ Code
+ check_bslib_theme("paper", pkg, bs_version = 4)
+ Condition
+ Error:
+ x Can't find Bootswatch/bslib theme preset "paper" (template.bootswatch).
+ i Using Bootstrap version 4 (template.bootstrap).
+ i Edit _pkgdown.yml to fix the problem.
+ Code
+ check_bslib_theme("paper", pkg, bs_version = 4, field = c("template", "preset"))
+ Condition
+ Error:
+ x Can't find Bootswatch/bslib theme preset "paper" (template and preset).
+ i Using Bootstrap version 4 (template.bootstrap).
+ i Edit _pkgdown.yml to fix the problem.
# capture data_template()
diff --git a/tests/testthat/_snaps/templates.md b/tests/testthat/_snaps/templates.md
index bd2f03b55..5bbab4edd 100644
--- a/tests/testthat/_snaps/templates.md
+++ b/tests/testthat/_snaps/templates.md
@@ -20,7 +20,13 @@
# Warns when Bootstrap theme is specified in multiple locations
- Multiple Bootstrap preset themes were set. Using "flatly" from template.bslib.preset.
- x Found template.bslib.preset, template.bslib.bootswatch, template.bootswatch, and template.params.bootswatch.
- i Remove extraneous theme declarations to avoid this warning.
+ Code
+ get_bslib_theme(pkg)
+ Condition
+ Warning:
+ Multiple Bootstrap preset themes were set. Using "flatly" from template.bslib.preset.
+ x Found template.bslib.preset, template.bslib.bootswatch, template.bootswatch, and template.params.bootswatch.
+ i Remove extraneous theme declarations to avoid this warning.
+ Output
+ [1] "flatly"
diff --git a/tests/testthat/test-build-articles.R b/tests/testthat/test-build-articles.R
index 316dbe672..8089a1452 100644
--- a/tests/testthat/test-build-articles.R
+++ b/tests/testthat/test-build-articles.R
@@ -50,7 +50,7 @@ test_that("articles don't include header-attrs.js script", {
pkg <- as_pkgdown(test_path("assets/articles"))
withr::defer(clean_site(pkg, quiet = TRUE))
- expect_snapshot(path <- build_article("standard", pkg))
+ suppressMessages(path <- build_article("standard", pkg))
html <- xml2::read_html(path)
js <- xpath_attr(html, ".//body//script", "src")
@@ -68,7 +68,7 @@ test_that("can build article that uses html_vignette", {
test_that("can override html_document() options", {
pkg <- local_pkgdown_site(test_path("assets/articles"))
- expect_snapshot(path <- build_article("html-document", pkg))
+ suppressMessages(path <- build_article("html-document", pkg))
# Check that number_sections is respected
html <- xml2::read_html(path)
@@ -84,7 +84,7 @@ test_that("can override html_document() options", {
test_that("html widgets get needed css/js", {
pkg <- local_pkgdown_site(test_path("assets/articles"))
- expect_snapshot(path <- build_article("widget", pkg))
+ suppressMessages(path <- build_article("widget", pkg))
html <- xml2::read_html(path)
css <- xpath_attr(html, ".//body//link", "href")
@@ -96,7 +96,7 @@ test_that("html widgets get needed css/js", {
test_that("can override options with _output.yml", {
pkg <- local_pkgdown_site(test_path("assets/articles"))
- expect_snapshot(path <- build_article("html-document", pkg))
+ suppressMessages(path <- build_article("html-document", pkg))
# Check that number_sections is respected
html <- xml2::read_html(path)
@@ -109,7 +109,7 @@ test_that("can set width", {
width: 50
")
- expect_snapshot(path <- build_article("width", pkg))
+ suppressMessages(path <- build_article("width", pkg))
html <- xml2::read_html(path)
expect_equal(xpath_text(html, ".//pre")[[2]], "## [1] 50")
})
@@ -119,7 +119,7 @@ test_that("finds external resources referenced by R code in the article html", {
skip_on_cran()
pkg <- local_pkgdown_site(test_path("assets", "articles-resources"))
- expect_snapshot(path <- build_article("resources", pkg))
+ suppressMessages(path <- build_article("resources", pkg))
# ensure that we the HTML references `` directly
expect_equal(
@@ -140,8 +140,8 @@ test_that("BS5 article laid out correctly with and without TOC", {
")
suppressMessages(init_site(pkg))
- expect_snapshot(toc_true_path <- build_article("standard", pkg))
- expect_snapshot(toc_false_path <- build_article("toc-false", pkg))
+ suppressMessages(toc_true_path <- build_article("standard", pkg))
+ suppressMessages(toc_false_path <- build_article("toc-false", pkg))
toc_true <- xml2::read_html(toc_true_path)
toc_false <- xml2::read_html(toc_false_path)
@@ -160,7 +160,7 @@ test_that("articles in vignettes/articles/ are unnested into articles/", {
skip_on_cran()
pkg <- local_pkgdown_site(test_path("assets/articles"))
- expect_snapshot(path <- build_article("articles/nested", pkg))
+ suppressMessages(path <- build_article("articles/nested", pkg))
expect_equal(
normalizePath(path),
@@ -191,7 +191,7 @@ test_that("pkgdown deps are included only once in articles", {
")
suppressMessages(init_site(pkg))
- expect_snapshot(path <- build_article("html-deps", pkg))
+ suppressMessages(path <- build_article("html-deps", pkg))
html <- xml2::read_html(path)
diff --git a/tests/testthat/test-build-home-index.R b/tests/testthat/test-build-home-index.R
index d1263056e..cfe581c7f 100644
--- a/tests/testthat/test-build-home-index.R
+++ b/tests/testthat/test-build-home-index.R
@@ -52,7 +52,7 @@ test_that("data_home_sidebar() can be defined by a HTML file", {
test_that("data_home_sidebar() errors well when no HTML file", {
pkg <- as_pkgdown(test_path("assets/sidebar"))
pkg$meta$home$sidebar$html <- "file.html"
- expect_snapshot_error(data_home_sidebar(pkg))
+ expect_snapshot(data_home_sidebar(pkg), error = TRUE)
})
test_that("data_home_sidebar() can get a custom markdown formatted component", {
diff --git a/tests/testthat/test-build-home.R b/tests/testthat/test-build-home.R
index b67cd17dc..f56fadc0d 100644
--- a/tests/testthat/test-build-home.R
+++ b/tests/testthat/test-build-home.R
@@ -4,7 +4,7 @@ test_that("intermediate files cleaned up automatically", {
skip_if_no_pandoc()
pkg <- local_pkgdown_site(test_path("assets/home-index-rmd"))
- expect_snapshot(build_home(pkg))
+ suppressMessages(build_home(pkg))
expect_setequal(dir(pkg$src_path), c("DESCRIPTION", "index.Rmd"))
})
@@ -13,7 +13,7 @@ test_that("intermediate files cleaned up automatically", {
skip_if_no_pandoc()
pkg <- local_pkgdown_site(test_path("assets/home-readme-rmd"))
- expect_snapshot(build_home(pkg))
+ suppressMessages(build_home(pkg))
expect_setequal(
dir(pkg$src_path),
@@ -25,7 +25,7 @@ test_that("can build site even if no Authors@R present", {
skip_if_no_pandoc()
pkg <- local_pkgdown_site(test_path("assets/home-old-skool"))
- expect_snapshot(build_home(pkg))
+ expect_no_error(build_home(pkg))
})
# .github files -----------------------------------------------------------
@@ -37,7 +37,7 @@ test_that(".github files are copied and linked", {
skip_if_not(dir_exists(test_path("assets/site-dot-github/.github")))
pkg <- local_pkgdown_site(test_path("assets/site-dot-github"))
- expect_snapshot(build_home(pkg))
+ suppressMessages(build_home(pkg))
lines <- read_lines(path(pkg$dst_path, "index.html"))
expect_true(any(grepl('href="CODE_OF_CONDUCT.html"', lines)))
diff --git a/tests/testthat/test-build-logo.R b/tests/testthat/test-build-logo.R
index de759a534..6af6fef9b 100644
--- a/tests/testthat/test-build-logo.R
+++ b/tests/testthat/test-build-logo.R
@@ -8,7 +8,7 @@ test_that("can handle logo in subdir", {
pkg <- structure(list(src_path = src, dst_path = dst), class = "pkgdown")
expect_true(has_logo(pkg))
- expect_snapshot(copy_logo(pkg))
+ suppressMessages(copy_logo(pkg))
expect_true(file_exists(path(dst, "logo.svg")))
expect_equal(logo_path(pkg, 0), "logo.svg")
diff --git a/tests/testthat/test-build-news.R b/tests/testthat/test-build-news.R
index 1bc55862d..41051546c 100644
--- a/tests/testthat/test-build-news.R
+++ b/tests/testthat/test-build-news.R
@@ -206,7 +206,7 @@ test_that("clear error for bad hierarchy - bad nesting", {
path(temp_pkg$src_path, "NEWS.md")
)
- expect_snapshot_error(data_news(temp_pkg))
+ expect_snapshot(data_news(temp_pkg), error = TRUE)
})
test_that("clear error for bad hierarchy - h3", {
@@ -227,7 +227,7 @@ test_that("clear error for bad hierarchy - h3", {
path(temp_pkg$src_path, "NEWS.md")
)
- expect_snapshot_error(data_news(temp_pkg))
+ expect_snapshot(data_news(temp_pkg), error = TRUE)
})
test_that("news can contain footnotes", {
diff --git a/tests/testthat/test-build-reference-index.R b/tests/testthat/test-build-reference-index.R
index 57f5de996..1f7c8ace9 100644
--- a/tests/testthat/test-build-reference-index.R
+++ b/tests/testthat/test-build-reference-index.R
@@ -66,39 +66,62 @@ test_that("default reference includes all functions", {
})
test_that("errors well when a content entry is empty", {
- meta <- yaml::yaml.load( "reference:\n- title: bla\n contents:\n - aname\n - ")
- pkg <- as_pkgdown(test_path("assets/reference"), override = meta)
-
- expect_snapshot_error(build_reference_index(pkg))
+ pkg <- local_pkgdown_site(test_path("assets/reference"), meta = "
+ reference:
+ - title: bla
+ contents:
+ - aname
+ -
+ ")
+ suppressMessages(init_site(pkg))
+
+ expect_snapshot(build_reference_index(pkg), error = TRUE)
})
test_that("errors well when a content entry is not a character", {
- meta <- yaml::yaml.load( "reference:\n- title: bla\n contents:\n - aname\n - N")
- pkg <- as_pkgdown(test_path("assets/reference"), override = meta)
+ pkg <- local_pkgdown_site(test_path("assets/reference"), meta = "
+ reference:
+ - title: bla
+ contents:
+ - aname
+ - N
+ ")
+ suppressMessages(init_site(pkg))
expect_snapshot(build_reference_index(pkg), error = TRUE)
})
test_that("errors well when a content is totally empty", {
- meta <- yaml::yaml.load( "reference:\n- title: bla\n contents: ~")
- pkg <- as_pkgdown(test_path("assets/reference"), override = meta)
+ pkg <- local_pkgdown_site(test_path("assets/reference"), meta = "
+ reference:
+ - title: bla
+ contents: ~
+ ")
+ suppressMessages(init_site(pkg))
expect_snapshot(build_reference_index(pkg), error = TRUE)
})
-
test_that("errors well when a content entry refers to a not installed package", {
- skip_if_not_installed("cli", "3.1.0")
-
- meta <- yaml::yaml.load( "reference:\n- title: bla\n contents:\n - notapackage::lala")
- pkg <- as_pkgdown(test_path("assets/reference"), override = meta)
+ pkg <- local_pkgdown_site(test_path("assets/reference"), meta = "
+ reference:
+ - title: bla
+ contents:
+ - notapackage::lala
+ ")
+ suppressMessages(init_site(pkg))
expect_snapshot(build_reference_index(pkg), error = TRUE)
})
test_that("errors well when a content entry refers to a non existing function", {
- meta <- yaml::yaml.load( "reference:\n- title: bla\n contents:\n - rlang::lala")
- pkg <- as_pkgdown(test_path("assets/reference"), override = meta)
+ pkg <- local_pkgdown_site(test_path("assets/reference"), meta = "
+ reference:
+ - title: bla
+ contents:
+ - rlang::lala
+ ")
+ suppressMessages(init_site(pkg))
expect_snapshot(build_reference_index(pkg), error = TRUE)
})
diff --git a/tests/testthat/test-build-reference.R b/tests/testthat/test-build-reference.R
index b9c0a18e5..c6fefd880 100644
--- a/tests/testthat/test-build-reference.R
+++ b/tests/testthat/test-build-reference.R
@@ -50,7 +50,7 @@ test_that("test usage ok on rendered page", {
test_that(".Rd without usage doesn't get Usage section", {
pkg <- local_pkgdown_site(test_path("assets/reference"))
- expect_snapshot(build_reference(pkg, topics = "e"))
+ suppressMessages(build_reference(pkg, topics = "e"))
html <- xml2::read_html(path(pkg$dst_path, "reference", "e.html"))
expect_equal(xpath_length(html, "//div[@id='ref-usage']"), 0)
clean_site(pkg, quiet = TRUE)
@@ -60,7 +60,7 @@ test_that(".Rd without usage doesn't get Usage section", {
bootstrap: 5
")
suppressMessages(init_site(pkg))
- expect_snapshot(build_reference(pkg, topics = "e"))
+ suppressMessages(build_reference(pkg, topics = "e"))
html <- xml2::read_html(path(pkg$dst_path, "reference", "e.html"))
# tweak_anchors() moves id into
expect_equal(xpath_length(html, "//div[h2[@id='ref-usage']]"), 0)
@@ -69,7 +69,7 @@ test_that(".Rd without usage doesn't get Usage section", {
test_that("pkgdown html dependencies are suppressed from examples in references", {
pkg <- local_pkgdown_site(test_path("assets/reference-html-dep"))
suppressMessages(init_site(pkg))
- expect_snapshot(build_reference(pkg, topics = "a"))
+ suppressMessages(build_reference(pkg, topics = "a"))
html <- xml2::read_html(path(pkg$dst_path, "reference", "a.html"))
# jquery is only loaded once, even though it's included by an example
diff --git a/tests/testthat/test-figure.R b/tests/testthat/test-figure.R
index 8aa6ffb26..962575e3e 100644
--- a/tests/testthat/test-figure.R
+++ b/tests/testthat/test-figure.R
@@ -6,11 +6,11 @@ test_that("can override defaults in _pkgdown.yml", {
callr::rcmd("INSTALL", pkg$src_path, show = FALSE, fail_on_status = TRUE)
- expect_snapshot(build_reference(pkg, devel = FALSE))
+ suppressMessages(build_reference(pkg, devel = FALSE))
img <- path_file(dir_ls(path(pkg$dst_path, "reference"), glob = "*.jpg"))
expect_setequal(img, c("figure-1.jpg", "figure-2.jpg"))
- expect_snapshot(build_articles(pkg))
+ suppressMessages(build_articles(pkg))
img <- path_file(dir_ls(path(pkg$dst_path, "articles"), glob = "*.jpg", recurse = TRUE))
expect_equal(img, "unnamed-chunk-1-1.jpg")
})
diff --git a/tests/testthat/test-markdown.R b/tests/testthat/test-markdown.R
index bb523a382..3e46d7f78 100644
--- a/tests/testthat/test-markdown.R
+++ b/tests/testthat/test-markdown.R
@@ -20,7 +20,7 @@ test_that("markdown_text_inline() works with inline markdown", {
expect_equal(markdown_text_inline("**lala**"), "lala")
pkg <- local_pkgdown_site()
- expect_snapshot_error(markdown_text_inline("x\n\ny", pkg = pkg))
+ expect_snapshot(markdown_text_inline("x\n\ny", pkg = pkg), error = TRUE)
})
test_that("markdown_text_block() works with inline and block markdown", {
diff --git a/tests/testthat/test-render.R b/tests/testthat/test-render.R
index 55b1ac327..95cf03f4f 100644
--- a/tests/testthat/test-render.R
+++ b/tests/testthat/test-render.R
@@ -2,8 +2,10 @@ test_that("check_bslib_theme() works", {
pkg <- as_pkgdown(test_path("assets/reference"))
expect_equal(check_bslib_theme("default", pkg, bs_version = 4), "default")
expect_equal(check_bslib_theme("lux", pkg, bs_version = 4), "lux")
- expect_snapshot_error(check_bslib_theme("paper", pkg, bs_version = 4))
- expect_snapshot_error(check_bslib_theme("paper", pkg, bs_version = 4, field = c("template", "preset")))
+ expect_snapshot(error = TRUE, {
+ check_bslib_theme("paper", pkg, bs_version = 4)
+ check_bslib_theme("paper", pkg, bs_version = 4, field = c("template", "preset"))
+ })
})
test_that("get_bslib_theme() works with template.bslib.preset", {
diff --git a/tests/testthat/test-templates.R b/tests/testthat/test-templates.R
index 2b0c4faa3..ec79a5d19 100644
--- a/tests/testthat/test-templates.R
+++ b/tests/testthat/test-templates.R
@@ -192,7 +192,7 @@ test_that("Warns when Bootstrap theme is specified in multiple locations", {
bootswatch: darkly
')
- expect_snapshot_warning(
+ expect_snapshot(
get_bslib_theme(pkg)
)
})