diff --git a/.Rbuildignore b/.Rbuildignore index beecf8507..a52bd6426 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -25,5 +25,7 @@ ^vignettes/articles/*_files$ ^vignettes/articles$ ^\.vscode$ -^[\.]?air\.toml$ ^\.git-blame-ignore-revs$ +^AGENTS\.md$ +^\.claude$ +^[.]?air[.]toml$ diff --git a/.claude/.gitignore b/.claude/.gitignore new file mode 100644 index 000000000..93c0f73fa --- /dev/null +++ b/.claude/.gitignore @@ -0,0 +1 @@ +settings.local.json diff --git a/.claude/CLAUDE.md b/.claude/CLAUDE.md new file mode 100644 index 000000000..dba71e970 --- /dev/null +++ b/.claude/CLAUDE.md @@ -0,0 +1 @@ +@../AGENTS.md diff --git a/.claude/settings.json b/.claude/settings.json new file mode 100644 index 000000000..0ab263f36 --- /dev/null +++ b/.claude/settings.json @@ -0,0 +1,9 @@ +{ + "$schema": "https://json.schemastore.org/claude-code-settings.json", + "permissions": { + "deny": [ + "Read(.Renviron)", + "Read(.env)" + ] + } +} diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index cc8d02e93..9a575317b 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -24,11 +24,7 @@ jobs: matrix: config: - {os: macos-latest, r: 'release'} - - {os: windows-latest, r: 'release'} - # use 4.0 or 4.1 to check with rtools40's older compiler - - {os: windows-latest, r: 'oldrel-3'} - - {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'} - {os: ubuntu-latest, r: 'release'} - {os: ubuntu-latest, r: 'oldrel-1'} @@ -41,19 +37,16 @@ jobs: R_KEEP_PKG_SOURCE: yes steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - uses: r-lib/actions/setup-pandoc@v2 - uses: r-lib/actions/setup-tinytex@v2 - env: - TINYTEX_INSTALLER: TinyTeX - uses: r-lib/actions/setup-r@v2 with: r-version: ${{ matrix.config.r }} http-user-agent: ${{ matrix.config.http-user-agent }} - use-public-rspm: true - uses: r-lib/actions/setup-r-dependencies@v2 with: @@ -61,8 +54,6 @@ jobs: needs: check - uses: r-lib/actions/check-r-package@v2 - env: - R_QUARTO_QUIET: false with: upload-snapshots: true build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")' diff --git a/.github/workflows/format-suggest.yaml b/.github/workflows/format-suggest.yaml new file mode 100644 index 000000000..8c4f117d8 --- /dev/null +++ b/.github/workflows/format-suggest.yaml @@ -0,0 +1,46 @@ +# Workflow derived from https://github.com/posit-dev/setup-air/tree/main/examples + +on: + # Using `pull_request_target` over `pull_request` for elevated `GITHUB_TOKEN` + # privileges, otherwise we can't set `pull-requests: write` when the pull + # request comes from a fork, which is our main use case (external contributors). + # + # `pull_request_target` runs in the context of the target branch (`main`, usually), + # rather than in the context of the pull request like `pull_request` does. Due + # to this, we must explicitly checkout `ref: ${{ github.event.pull_request.head.sha }}`. + # This is typically frowned upon by GitHub, as it exposes you to potentially running + # untrusted code in a context where you have elevated privileges, but they explicitly + # call out the use case of reformatting and committing back / commenting on the PR + # as a situation that should be safe (because we aren't actually running the untrusted + # code, we are just treating it as passive data). + # https://securitylab.github.com/resources/github-actions-preventing-pwn-requests/ + pull_request_target: + +name: format-suggest.yaml + +jobs: + format-suggest: + name: format-suggest + runs-on: ubuntu-latest + + permissions: + # Required to push suggestion comments to the PR + pull-requests: write + + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha }} + + - name: Install + uses: posit-dev/setup-air@v1 + + - name: Format + run: air format . + + - name: Suggest + uses: reviewdog/action-suggester@v1 + with: + level: error + fail_level: error + tool_name: air diff --git a/.github/workflows/pkgdown.yaml b/.github/workflows/pkgdown.yaml index 04d9d6498..fd06dc713 100644 --- a/.github/workflows/pkgdown.yaml +++ b/.github/workflows/pkgdown.yaml @@ -23,13 +23,11 @@ jobs: permissions: contents: write steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - uses: r-lib/actions/setup-pandoc@v2 - uses: r-lib/actions/setup-r@v2 - with: - use-public-rspm: true - uses: r-lib/actions/setup-r-dependencies@v2 with: @@ -44,7 +42,7 @@ jobs: - name: Deploy to GitHub pages 🚀 if: github.event_name != 'pull_request' - uses: JamesIves/github-pages-deploy-action@v4.5.0 + uses: JamesIves/github-pages-deploy-action@d92aa235d04922e8f08b40ce78cc5442fcfbfa2f # v4.8.0 with: clean: false branch: gh-pages diff --git a/.github/workflows/test-coverage.yaml b/.github/workflows/test-coverage.yaml index 0644349a3..23907be30 100644 --- a/.github/workflows/test-coverage.yaml +++ b/.github/workflows/test-coverage.yaml @@ -16,23 +16,19 @@ jobs: GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - uses: r-lib/actions/setup-pandoc@v2 + - uses: r-lib/actions/setup-tinytex@v2 + - uses: r-lib/actions/setup-r@v2 - with: - use-public-rspm: true - uses: r-lib/actions/setup-r-dependencies@v2 with: extra-packages: any::covr, any::xml2 needs: coverage - - uses: r-lib/actions/setup-tinytex@v2 - env: - TINYTEX_INSTALLER: TinyTeX - - name: Test coverage run: | cov <- covr::package_coverage( @@ -44,7 +40,7 @@ jobs: covr::to_cobertura(cov) shell: Rscript {0} - - uses: codecov/codecov-action@v5 + - uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7 with: # Fail if error if not on PR, or if on PR and token is given fail_ci_if_error: ${{ github.event_name != 'pull_request' || secrets.CODECOV_TOKEN }} @@ -62,7 +58,7 @@ jobs: - name: Upload test results if: failure() - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v7 with: name: coverage-test-failures path: ${{ runner.temp }}/package diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 000000000..5ea162b84 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,115 @@ +## This package + + + +## Package development + +### Key commands + +(All these functions have been optimized for agentic use, so they can be called directly without other arguments.) + +```R +# Executing code +devtools::load_all() +code + +# Tests +devtools::test() # all tests +devtools::test(filter = "^{name}") # tests for files starting with {name} +devtools::test_active_file("R/{name}.R") # tests for R/{name}.R +devtools::test_active_file("R/{name}.R", desc = 'blah') # single test with exact description "blah" (no regexp) + +# Test coverage +devtools::test_coverage() # all files +devtools::test_coverage_active_file("R/{name}.R") # coverage for R/{name}.R from tests in tests/testthat/test-{name}.R + +# Documentation +devtools::document() # redocument package +pkgdown::check_pkgdown() # check website + +# Run complete R CMD check +devtools::check() +``` + +### Running R + +There are three possible ways to run code, listed in rough order of desirability: + +- If you're running inside Posit Assistant or otherwise have an + `executeCode()` tool available, use it to run code in a session that the + user can also interact with. + +- Otherwise, if an R REPL (e.g. `mcp__r__repl` or `btw::run_r`) is + available, use that. Note that `mcp__r__repl` uses a sandbox that blocks + network requests and reads/writes outside of the current directory. + +- Otherwise, use `Rscript -e "code"`. + +### Code style + +- Follow the tidyverse style guide +- Always run `air format .` after generating code. +- Use the base pipe operator (`|>`), not the magrittr pipe (`%>%`). +- Use `\() ...` for single-line anonymous functions. For all other cases, use `function() {...}`. + +### Test style + +- Tests for `R/{name}.R` go in `tests/testthat/test-{name}.R`. +- All new code should have an accompanying test. +- If there are existing tests, place new tests next to similar existing tests. +- Strive to keep your tests minimal with few comments. +- Never put code in a `test-{name}.R` file outside of a `test_that()` block. Instead, use `tests/testthat/helper.R` or `tests/testthat/helper-{name}.R`. +- Avoid `expect_true()` and `expect_false()` in favor of a specific expectation with a better failure message. A few expectations in newer releases that you might not know about are `expect_all_true()`, `expect_all_equal()`, and `expect_r6_class()`. +- When testing errors and warnings: + - Only use `expect_error()` or `expect_warning()` if the error or warning has a known class. + - Generally, prefer `expect_snapshot(error = TRUE)` for errors and `expect_snapshot()` for warnings because these allow the user to review the full text of the output. +- Avoid the `.package` argument to `local_mocked_bindings()`; this modifies the namespace of another package, which is not good practice. Instead create a mockable version of the function in the current package. See `?local_mocked_bindings` for more details. + +### Documentation + +- Every user-facing function should be exported and have roxygen2 documentation. +- Internal functions should not have roxygen documentation. +- Wrap roxygen2 comments to 80 characters. +- Whenever you add a new (non-internal) documentation topic, also add the topic to `_pkgdown.yml`. +- Always re-document the package after changing a roxygen2 comment. +- Use `pkgdown::check_pkgdown()` to check that all topics are included in the reference index. + +### `NEWS.md` + +- Every user-facing change should be given a bullet in `NEWS.md`. +- Changes that shouldn't get a bullet: + - Small documentation changes. + - Internal refactorings. + - Fixes to bugs introduced in the current dev version. +- Each bullet should briefly describe the change to the end user and mention the related issue in parentheses. +- A bullet can consist of multiple sentences but should not contain any newlines (i.e. DO NOT line wrap). +- If the change is related to a function, put the name of the function early in the bullet. +- If the change is related to an issue, include the issue number in parentheses. +- Only include a GitHub username if the PR was created by someone who isn't an author. +- Order bullets alphabetically by function name. Put all bullets that don't mention function names at the beginning. + +## Specialized skills + +- Do you need to deprecate a function or argument? Read the output of `usethis::learn_tidy_skill("deprecate")`. +- Are you adding input checking to an existing function or writing a new exported function? Read the output of `usethis::learn_tidy_skill("arg-checking")`. + +## Git + +- If the user asks you to commit, use markdown in the commit message, and don't line wrap. +- If the commit fixes an issue, include `Fixes #num.` on its own line. +- Only push when the user explicitly requests it. + +## Writing + +- Use sentence case for headings. +- Use US English. + +### Proofreading + +If the user asks you to proofread a file, act as an expert proofreader and editor with a deep understanding of clear, engaging, and well-structured writing. + +Work paragraph by paragraph, always starting by making a TODO list that includes individual items for each top-level section. + +Fix spelling, grammar, and other minor problems without asking the user. Label any unclear, confusing, or ambiguous sentences with a FIXME comment. + +Only report what you have changed. diff --git a/DESCRIPTION b/DESCRIPTION index c0848ca0b..4e1f6b215 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -34,8 +34,8 @@ Imports: httr2 (>= 1.0.2), jsonlite, lifecycle, - openssl, nanonext (>= 1.8.0), + openssl, purrr (>= 1.0.0), ragg (>= 1.4.0), rlang (>= 1.1.4), @@ -69,6 +69,7 @@ VignetteBuilder: quarto Config/Needs/website: usethis, servr Config/potools/style: explicit +Config/roxygen2/version: 8.0.0 Config/testthat/edition: 3 Config/testthat/parallel: true Config/testthat/start-first: build-article, build-quarto-article, @@ -76,5 +77,4 @@ Config/testthat/start-first: build-article, build-quarto-article, Config/usethis/last-upkeep: 2025-09-07 Encoding: UTF-8 Roxygen: list(markdown = TRUE) -RoxygenNote: 7.3.3 SystemRequirements: pandoc (>= 2.10.1) diff --git a/man/build_articles.Rd b/man/build_articles.Rd index 108e0ae25..6c7c6d503 100644 --- a/man/build_articles.Rd +++ b/man/build_articles.Rd @@ -259,11 +259,11 @@ as HTML widgets. } \seealso{ -Other site components: -\code{\link{build_home}()}, -\code{\link{build_llm_docs}()}, -\code{\link{build_news}()}, -\code{\link{build_reference}()}, -\code{\link{build_tutorials}()} +Other site components: +\code{\link[=build_home]{build_home()}}, +\code{\link[=build_llm_docs]{build_llm_docs()}}, +\code{\link[=build_news]{build_news()}}, +\code{\link[=build_reference]{build_reference()}}, +\code{\link[=build_tutorials]{build_tutorials()}} } \concept{site components} diff --git a/man/build_home.Rd b/man/build_home.Rd index dc588e297..e1eb44ebc 100644 --- a/man/build_home.Rd +++ b/man/build_home.Rd @@ -296,11 +296,11 @@ Or completely remove it: } \seealso{ -Other site components: -\code{\link{build_articles}()}, -\code{\link{build_llm_docs}()}, -\code{\link{build_news}()}, -\code{\link{build_reference}()}, -\code{\link{build_tutorials}()} +Other site components: +\code{\link[=build_articles]{build_articles()}}, +\code{\link[=build_llm_docs]{build_llm_docs()}}, +\code{\link[=build_news]{build_news()}}, +\code{\link[=build_reference]{build_reference()}}, +\code{\link[=build_tutorials]{build_tutorials()}} } \concept{site components} diff --git a/man/build_llm_docs.Rd b/man/build_llm_docs.Rd index 204ffdf70..8d546ce9a 100644 --- a/man/build_llm_docs.Rd +++ b/man/build_llm_docs.Rd @@ -23,11 +23,11 @@ adding the following to your \code{pkgdown.yml}: }\if{html}{\out{}} } \seealso{ -Other site components: -\code{\link{build_articles}()}, -\code{\link{build_home}()}, -\code{\link{build_news}()}, -\code{\link{build_reference}()}, -\code{\link{build_tutorials}()} +Other site components: +\code{\link[=build_articles]{build_articles()}}, +\code{\link[=build_home]{build_home()}}, +\code{\link[=build_news]{build_news()}}, +\code{\link[=build_reference]{build_reference()}}, +\code{\link[=build_tutorials]{build_tutorials()}} } \concept{site components} diff --git a/man/build_news.Rd b/man/build_news.Rd index b6d9a61d2..0f5508664 100644 --- a/man/build_news.Rd +++ b/man/build_news.Rd @@ -82,11 +82,11 @@ Suppress the default addition of CRAN release dates with: \seealso{ \href{https://style.tidyverse.org/news.html}{Tidyverse style for News} -Other site components: -\code{\link{build_articles}()}, -\code{\link{build_home}()}, -\code{\link{build_llm_docs}()}, -\code{\link{build_reference}()}, -\code{\link{build_tutorials}()} +Other site components: +\code{\link[=build_articles]{build_articles()}}, +\code{\link[=build_home]{build_home()}}, +\code{\link[=build_llm_docs]{build_llm_docs()}}, +\code{\link[=build_reference]{build_reference()}}, +\code{\link[=build_tutorials]{build_tutorials()}} } \concept{site components} diff --git a/man/build_reference.Rd b/man/build_reference.Rd index cb14c2795..0968a70c3 100644 --- a/man/build_reference.Rd +++ b/man/build_reference.Rd @@ -187,11 +187,11 @@ as HTML widgets. } \seealso{ -Other site components: -\code{\link{build_articles}()}, -\code{\link{build_home}()}, -\code{\link{build_llm_docs}()}, -\code{\link{build_news}()}, -\code{\link{build_tutorials}()} +Other site components: +\code{\link[=build_articles]{build_articles()}}, +\code{\link[=build_home]{build_home()}}, +\code{\link[=build_llm_docs]{build_llm_docs()}}, +\code{\link[=build_news]{build_news()}}, +\code{\link[=build_tutorials]{build_tutorials()}} } \concept{site components} diff --git a/man/build_tutorials.Rd b/man/build_tutorials.Rd index 0934c3656..96327dc38 100644 --- a/man/build_tutorials.Rd +++ b/man/build_tutorials.Rd @@ -44,11 +44,11 @@ section. This should be a list where each element specifies: } \seealso{ -Other site components: -\code{\link{build_articles}()}, -\code{\link{build_home}()}, -\code{\link{build_llm_docs}()}, -\code{\link{build_news}()}, -\code{\link{build_reference}()} +Other site components: +\code{\link[=build_articles]{build_articles()}}, +\code{\link[=build_home]{build_home()}}, +\code{\link[=build_llm_docs]{build_llm_docs()}}, +\code{\link[=build_news]{build_news()}}, +\code{\link[=build_reference]{build_reference()}} } \concept{site components} diff --git a/man/deploy_site_github.Rd b/man/deploy_site_github.Rd index 234b83b77..6b85ca463 100644 --- a/man/deploy_site_github.Rd +++ b/man/deploy_site_github.Rd @@ -50,7 +50,7 @@ new keypair specifically for deploying the site. The easiest way is to use which we no longer recommend, so this function is deprecated. There are two replacements: \itemize{ -\item \code{\link[usethis:use_pkgdown]{usethis::use_pkgdown_github_pages()}} will setup a GitHub action to +\item \code{\link[usethis:use_pkgdown_github_pages]{usethis::use_pkgdown_github_pages()}} will setup a GitHub action to automatically build and deploy your package website to GitHub pages. \item \code{\link[=deploy_to_branch]{deploy_to_branch()}} can be called locally to build and deploy your website to any desired branch. diff --git a/man/deploy_to_branch.Rd b/man/deploy_to_branch.Rd index 92433d29c..4c4f192c9 100644 --- a/man/deploy_to_branch.Rd +++ b/man/deploy_to_branch.Rd @@ -40,6 +40,6 @@ package documentation in the \verb{v.1.2.3/} directory of your site.} } \description{ Assumes that you're in a git clone of the project, and the package is -already installed. Use \code{\link[usethis:use_pkgdown]{usethis::use_pkgdown_github_pages()}} to automate +already installed. Use \code{\link[usethis:use_pkgdown_github_pages]{usethis::use_pkgdown_github_pages()}} to automate this process using GitHub actions. } diff --git a/man/index.Rd b/man/index.Rd index da52d62fc..a8e46e980 100644 --- a/man/index.Rd +++ b/man/index.Rd @@ -8,7 +8,7 @@ Index } \seealso{ -Other tests: +Other tests: \code{\link{test-crayon}}, \code{\link{test-dont}}, \code{\link{test-figures}}, diff --git a/man/init_site.Rd b/man/init_site.Rd index b769b65a9..124cd63e8 100644 --- a/man/init_site.Rd +++ b/man/init_site.Rd @@ -35,7 +35,7 @@ See \code{vignette("customise")} for the various ways you can customise the display of your site. } \section{Build-ignored files}{ -We recommend using \code{\link[usethis:use_pkgdown]{usethis::use_pkgdown_github_pages()}} to build-ignore \verb{docs/} and +We recommend using \code{\link[usethis:use_pkgdown_github_pages]{usethis::use_pkgdown_github_pages()}} to build-ignore \verb{docs/} and \verb{_pkgdown.yml}. If use another directory, or create the site manually, you'll need to add them to \code{.Rbuildignore} yourself. A \code{NOTE} about an unexpected file during \verb{R CMD CHECK} is an indication you have not diff --git a/man/pkgdown-package.Rd b/man/pkgdown-package.Rd index 62bb3c11f..785fb53ea 100644 --- a/man/pkgdown-package.Rd +++ b/man/pkgdown-package.Rd @@ -24,6 +24,7 @@ Useful links: Authors: \itemize{ + \item Hadley Wickham \email{hadley@posit.co} (\href{https://orcid.org/0000-0003-4757-117X}{ORCID}) \item Jay Hesselberth (\href{https://orcid.org/0000-0002-6299-179X}{ORCID}) \item Maëlle Salmon (\href{https://orcid.org/0000-0002-2815-0399}{ORCID}) \item Olivier Roy diff --git a/man/test-crayon.Rd b/man/test-crayon.Rd index 1597f40ea..2f011d025 100644 --- a/man/test-crayon.Rd +++ b/man/test-crayon.Rd @@ -15,7 +15,7 @@ message(cli::col_green("This is green")) warning(cli::style_bold("This is bold")) } \seealso{ -Other tests: +Other tests: \code{\link{index}}, \code{\link{test-dont}}, \code{\link{test-figures}}, diff --git a/man/test-dont.Rd b/man/test-dont.Rd index 7d7bba880..5c7a9ac0f 100644 --- a/man/test-dont.Rd +++ b/man/test-dont.Rd @@ -65,7 +65,7 @@ x <- 3 x # should be 3 } \seealso{ -Other tests: +Other tests: \code{\link{index}}, \code{\link{test-crayon}}, \code{\link{test-figures}}, diff --git a/man/test-figures.Rd b/man/test-figures.Rd index a8765bea7..0782d7ae6 100644 --- a/man/test-figures.Rd +++ b/man/test-figures.Rd @@ -17,7 +17,7 @@ text(2, 5, "Hello", srt = 30, cex = 2) plot(1:3, col = c("red", "green", "blue"), pch = 16, cex = 10) } \seealso{ -Other tests: +Other tests: \code{\link{index}}, \code{\link{test-crayon}}, \code{\link{test-dont}}, diff --git a/man/test-links.Rd b/man/test-links.Rd index 201255be3..fdb5da1a1 100644 --- a/man/test-links.Rd +++ b/man/test-links.Rd @@ -15,7 +15,7 @@ library(jsonlite, warn.conflicts = FALSE) minify("{}") } \seealso{ -Other tests: +Other tests: \code{\link{index}}, \code{\link{test-crayon}}, \code{\link{test-dont}}, diff --git a/man/test-lists.Rd b/man/test-lists.Rd index f3dbdce2d..ce7bd5ae3 100644 --- a/man/test-lists.Rd +++ b/man/test-lists.Rd @@ -48,7 +48,7 @@ } } \seealso{ -Other tests: +Other tests: \code{\link{index}}, \code{\link{test-crayon}}, \code{\link{test-dont}}, diff --git a/man/test-long-lines.Rd b/man/test-long-lines.Rd index 660f29363..273bae8b7 100644 --- a/man/test-long-lines.Rd +++ b/man/test-long-lines.Rd @@ -16,7 +16,7 @@ cat(rep("x ", 100), sep = "") cat(rep("xy", 100), sep = "") } \seealso{ -Other tests: +Other tests: \code{\link{index}}, \code{\link{test-crayon}}, \code{\link{test-dont}}, diff --git a/man/test-math-examples.Rd b/man/test-math-examples.Rd index 23d374e23..24e72c998 100644 --- a/man/test-math-examples.Rd +++ b/man/test-math-examples.Rd @@ -27,7 +27,7 @@ l >= (yj / tj) for all j in J & sum_i^I (xi * ci) <= B} } \seealso{ -Other tests: +Other tests: \code{\link{index}}, \code{\link{test-crayon}}, \code{\link{test-dont}}, diff --git a/man/test-output-styles.Rd b/man/test-output-styles.Rd index dc6645ab8..579c974d5 100644 --- a/man/test-output-styles.Rd +++ b/man/test-output-styles.Rd @@ -23,7 +23,7 @@ warning("This is a warning!") } } \seealso{ -Other tests: +Other tests: \code{\link{index}}, \code{\link{test-crayon}}, \code{\link{test-dont}}, diff --git a/man/test-params.Rd b/man/test-params.Rd index 393a2390c..700a43587 100644 --- a/man/test-params.Rd +++ b/man/test-params.Rd @@ -10,7 +10,7 @@ Test case: params } \seealso{ -Other tests: +Other tests: \code{\link{index}}, \code{\link{test-crayon}}, \code{\link{test-dont}}, diff --git a/man/test-sexpr-title.Rd b/man/test-sexpr-title.Rd index f64961005..1adcbea6d 100644 --- a/man/test-sexpr-title.Rd +++ b/man/test-sexpr-title.Rd @@ -7,7 +7,7 @@ Test case: \Sexpr[stage=render,results=rd]{"sexpr"} } \seealso{ -Other tests: +Other tests: \code{\link{index}}, \code{\link{test-crayon}}, \code{\link{test-dont}}, diff --git a/man/test-tables.Rd b/man/test-tables.Rd index cf3e14784..b59b2169a 100644 --- a/man/test-tables.Rd +++ b/man/test-tables.Rd @@ -10,7 +10,7 @@ Test case: tables gt::gt(head(mtcars)) } \seealso{ -Other tests: +Other tests: \code{\link{index}}, \code{\link{test-crayon}}, \code{\link{test-dont}}, diff --git a/man/test-verbatim.Rd b/man/test-verbatim.Rd index 6ece64f32..caa5f0e35 100644 --- a/man/test-verbatim.Rd +++ b/man/test-verbatim.Rd @@ -37,7 +37,7 @@ Non-R code in \verb{\preformatted{}} } \seealso{ -Other tests: +Other tests: \code{\link{index}}, \code{\link{test-crayon}}, \code{\link{test-dont}}, diff --git a/tests/testthat/_snaps/build-quarto-articles.md b/tests/testthat/_snaps/build-quarto-articles.md index bf7b98aee..97a6df730 100644 --- a/tests/testthat/_snaps/build-quarto-articles.md +++ b/tests/testthat/_snaps/build-quarto-articles.md @@ -4,6 +4,9 @@ cat(data$includes$style) Output + /* Default styles provided by pandoc. + ** See https://pandoc.org/MANUAL.html#variables-for-html for config info. + */ code{white-space: pre-wrap;} span.smallcaps{font-variant: small-caps;} div.columns{display: flex; gap: min(4vw, 1.5em);} diff --git a/tests/testthat/_snaps/build-reference.md b/tests/testthat/_snaps/build-reference.md index 59e9de3ff..e2719c4d3 100644 --- a/tests/testthat/_snaps/build-reference.md +++ b/tests/testthat/_snaps/build-reference.md @@ -18,5 +18,5 @@ Code cat(examples) Output - #> [1] 0.600760886 0.157208442 0.007399441 0.466393497 0.497777389 + #> [1] 0.080750138 0.834333037 0.600760886 0.157208442 0.007399441 diff --git a/tests/testthat/_snaps/init.md b/tests/testthat/_snaps/init.md index 56b905cd8..1f8eb2336 100644 --- a/tests/testthat/_snaps/init.md +++ b/tests/testthat/_snaps/init.md @@ -8,9 +8,9 @@ Copying /BS5/assets/lightswitch.js to lightswitch.js Copying /BS5/assets/link.svg to link.svg Copying /BS5/assets/pkgdown.js to pkgdown.js - Updating deps/bootstrap-5.3.1/bootstrap.bundle.min.js - Updating deps/bootstrap-5.3.1/bootstrap.bundle.min.js.map - Updating deps/bootstrap-5.3.1/bootstrap.min.css + Updating deps/bootstrap-5.3.8/bootstrap.bundle.min.js + Updating deps/bootstrap-5.3.8/bootstrap.bundle.min.js.map + Updating deps/bootstrap-5.3.8/bootstrap.min.css Updating deps/bootstrap-toc-1.0.1/bootstrap-toc.min.js Updating deps/clipboard.js-2.0.11/clipboard.min.js Updating deps/font-awesome-6.5.2/css/all.css diff --git a/tests/testthat/test-build-article.R b/tests/testthat/test-build-article.R index bac5b85f2..c46b9f968 100644 --- a/tests/testthat/test-build-article.R +++ b/tests/testthat/test-build-article.R @@ -226,10 +226,10 @@ test_that("build_article yields useful error if pandoc fails", { ) ) - expect_error( + suppressMessages(expect_error( build_article("test", pkg, pandoc_args = "--fail-if-warnings"), "Note with key .+ defined at .+ but not used" - ) + )) }) test_that("build_article yields useful error if R fails", { diff --git a/tests/testthat/test-preview.R b/tests/testthat/test-preview.R index ff3081921..74e9227a6 100644 --- a/tests/testthat/test-preview.R +++ b/tests/testthat/test-preview.R @@ -34,7 +34,7 @@ test_that("preview starts new server when none exists", { urls <- character() withr::local_options(browser = function(url) urls <<- c(urls, url)) - preview_site(pkg, preview = TRUE) + suppressMessages(preview_site(pkg, preview = TRUE)) expect_false(is.null(the$server)) expect_equal(the$server_root, pkg$dst_path) @@ -48,11 +48,11 @@ test_that("preview reuses server for same root", { urls <- character() withr::local_options(browser = function(url) urls <<- c(urls, url)) - preview_site(pkg, preview = TRUE) + suppressMessages(preview_site(pkg, preview = TRUE)) server1 <- the$server file_create(path(pkg$dst_path, "test.html")) - preview_site(pkg, path = "test.html", preview = TRUE) + suppressMessages(preview_site(pkg, path = "test.html", preview = TRUE)) expect_identical(the$server, server1) expect_length(urls, 2) @@ -66,10 +66,10 @@ test_that("preview starts new server for different root", { urls <- character() withr::local_options(browser = function(url) urls <<- c(urls, url)) - preview_site(pkg1, preview = TRUE) + suppressMessages(preview_site(pkg1, preview = TRUE)) server1 <- the$server - preview_site(pkg2, preview = TRUE) + suppressMessages(preview_site(pkg2, preview = TRUE)) expect_false(identical(the$server, server1)) expect_equal(the$server_root, pkg2$dst_path) @@ -80,10 +80,10 @@ test_that("stop_preview stops server", { local_preview_clean() withr::local_options(browser = function(url) {}) - preview_site(pkg, preview = TRUE) + suppressMessages(preview_site(pkg, preview = TRUE)) expect_false(is.null(the$server)) - stop_preview() + suppressMessages(stop_preview()) expect_null(the$server) expect_null(the$server_root) }) @@ -97,12 +97,14 @@ test_that("preview constructs correct URLs for sub-paths", { dir_create(path(pkg$dst_path, "reference")) file_create(path(pkg$dst_path, "reference", "foo.html")) - preview_site(pkg, preview = TRUE) + suppressMessages(preview_site(pkg, preview = TRUE)) base_url <- the$server$url - preview_site(pkg, path = "reference", preview = TRUE) + suppressMessages(preview_site(pkg, path = "reference", preview = TRUE)) expect_equal(urls[[2]], paste0(base_url, "/reference")) - preview_site(pkg, path = "reference/foo.html", preview = TRUE) + suppressMessages( + preview_site(pkg, path = "reference/foo.html", preview = TRUE) + ) expect_equal(urls[[3]], paste0(base_url, "/reference/foo.html")) }) diff --git a/tests/testthat/test-utils.R b/tests/testthat/test-utils.R index 9ffaba613..19fb64aad 100644 --- a/tests/testthat/test-utils.R +++ b/tests/testthat/test-utils.R @@ -1,5 +1,5 @@ test_that("is_internal_link() works", { - pkg = list(meta = list(url = "https://pkgdown.r-lib.org")) + pkg <- list(meta = list(url = "https://pkgdown.r-lib.org")) expect_false(is_internal_link("https://github.com", pkg = pkg)) expect_false(is_internal_link("http://github.com", pkg = pkg)) expect_true(is_internal_link("https://pkgdown.r-lib.org/articles", pkg = pkg))