Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: fix pandoc --fail-if-warnings test #2861

Merged
merged 1 commit into from
Feb 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 0 additions & 16 deletions tests/testthat/_snaps/build-article.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,6 @@

<span class="co">## <span style="color: #BB0000;">X</span></span>

# build_article yields useful error if pandoc fails

Code
build_article("test", pkg, pandoc_args = "--fail-if-warnings")
Message
Reading vignettes/test.Rmd
Condition
Error in `build_article()`:
! Failed to render 'vignettes/test.Rmd'.
x [WARNING] This document format requires a nonempty <title> element.
x Defaulting to 'test.knit' as the title.
x To specify a title, use 'title' in metadata or --metadata title="...".
x Failing because there were warnings.
Caused by error:
! pandoc document conversion failed with error 3

# build_article yields useful error if R fails

Code
Expand Down
11 changes: 8 additions & 3 deletions tests/testthat/test-build-article.R
Original file line number Diff line number Diff line change
Expand Up @@ -176,11 +176,16 @@ test_that("build_article yields useful error if pandoc fails", {
skip_if_no_pandoc("2.18")

pkg <- local_pkgdown_site()
pkg <- pkg_add_file(pkg, "vignettes/test.Rmd", "Hi")
pkg <- pkg_add_file(pkg, "vignettes/test.Rmd", c(
"Some text.",
"",
"[^1]: Unreferenced footnote.",
""
))

expect_snapshot(
expect_error(
build_article("test", pkg, pandoc_args = "--fail-if-warnings"),
error = TRUE
"Note with key .+ defined at .+ but not used"
)
})

Expand Down
Loading