Conversation
Adapted for #301 Default is now in v1.9 ```` ❯ quarto list extensions Id Version Contributes julia-engine 0.1.0 orange-book 0.1.0 formats ````
Verify now that extension is in the list before trying to remove. And only test for no extension for quarto before v1.9 due to #301
Pure function that builds the --metadata-file CLI args from the metadata list and metadata_file path. Returns the args plus the temp file path (when one was written) so the caller can register cleanup. No behavior change yet — quarto_render() still uses its inline implementation. Next commit wires the helper in.
Replace the inline metadata branch (~14 lines) with a single call to the extracted helper. Behavior preserved: same args produced, same temp file cleanup via on.exit. Explicit metadata_file = NULL is now treated as omitted instead of hitting yaml::read_yaml(NULL).
Renders a project with a _quarto.yml containing a custom-key value and verifies that quarto_render(metadata = ...) overrides the key. A Lua filter strips all metadata except an allowlist so the native-AST snapshot stays small and stable across Quarto versions (no churn from injected engines metadata or similar). Note: toc-title is a format-level option consumed by Quarto before pandoc sees it, so it does not appear in native AST metadata. The test uses a top-level document metadata key instead, which is the correct surface for verifying --metadata-file override behaviour.
The three native-AST snapshot tests for the metadata/metadata_file args were testing Quarto's downstream Pandoc behavior, not the R wrapper's contribution. They also churned whenever Quarto changed what it injects into native output (most recently an engines MetaList with absolute extension paths). Coverage now lives in: - test-metadata-args.R: unit tests of cli_arg_metadata() (no Quarto) - test-metadata-render.R: one integration test exercising override of a top-level _quarto.yml key via a Lua filter that allowlists the metadata keys we care about, keeping the snapshot stable.
- Add skip_if_not_installed("withr") to three tests in
test-metadata-args.R that use withr:: calls. withr is in Suggests,
not Imports, so the no-Quarto CI cell (which may not install
suggested packages) needs the guard.
- Rename metadata-nested-override.test.out to
metadata-toplevel-override.test.out — the test demonstrates a
top-level key override, not a nested format key (which would not
appear in native AST output).
Theme tests require brand.yml package (used by bslib::bs_theme(brand=)). Since brand.yml is in bslib's Suggests, it's not installed transitively.
gdtools::font_set_liberation() can fail with confusing errors when the cache directory cannot be created (e.g., permission issues). See davidgohel/gdtools#82
Covers the on.exit unlink branch in cli_arg_metadata() added in ea36f05. Without coverage a regression could silently leak temp files on write failures.
Quarto CLI prepends `Quarto version: X.Y.Z` to stderr whenever the log level is DEBUG, which is auto-enabled by GitHub Actions when a workflow is re-run with debug logging. That prefix line breaks any consumer that parses CLI stderr — in our case `quarto_list_extensions()` was feeding the line to `read.table(header = TRUE)`, where it became the header row and `df$Id` resolved to NULL. Strip the line in `quarto_list_extensions()` before parsing, and in the shared snapshot transform so error-output snapshots stay stable across debug and non-debug runs. See quarto-dev/quarto-cli#14532 for the upstream behaviour.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Updates the test suite for upstream Quarto v1.9 behaviour changes, replaces the fragile metadata snapshot tests with a stable helper plus focused integration coverage, and shores up test skips for missing optional dependencies.
Quarto v1.9 adaptations
quarto_list_extensions()/quarto_remove_extensions()/ tests adapted for thequarto list extensionsoutput change (quarto list extensions change in v1.9 #301): verify extension presence before remove, resolve the extension id explicitly, gate no-extension assertions on pre-v1.9 QuartoQuarto version: X.Y.ZDEBUG-mode prefix that Quarto v1.9 prepends to stderr under GitHub Actions debug logging — was breakingquarto_list_extensions()parsing (DEBUG log level prepends "Quarto version: X.Y.Z" line to stderr for all commands quarto-cli#14532)Metadata args refactor and tests
cli_arg_metadata()fromquarto_render()as a pure helper building--metadata-fileargs; treats explicitmetadata_file = NULLas omitted, and useson.exitto clean up the temp YAML file on errorcli_arg_metadata()plus integration tests that use a Lua filter to allowlist metadata keys — covers bothmetadata=override of a top-level_quarto.ymlkey and temp-file cleanup on write failureTest infrastructure
gdtools::font_set_liberation()fails (font_set_liberation() fails with confusing error when cache directory cannot be created davidgohel/gdtools#82)expect_snapshothint glitch (snapshot_accept()/snapshot_review()hint includes wrongpathwhen a test changes the working directory r-lib/testthat#2335)