diff --git a/src/execute/rmd.ts b/src/execute/rmd.ts index 3e44f8e7387..97b747a5b0d 100644 --- a/src/execute/rmd.ts +++ b/src/execute/rmd.ts @@ -272,11 +272,19 @@ async function callR( wd: cwd, }); + // QUARTO_KNITR_RSCRIPT_ARGS allows to pass additional arguments to Rscript as comma separated values + // e.g. QUARTO_KNITR_RSCRIPT_ARGS="--vanilla,--no-init-file,--max-connections=258" + const rscriptArgs = Deno.env.get("QUARTO_KNITR_RSCRIPT_ARGS") || ""; + const rscriptArgsArray = rscriptArgs.split(",").filter((a) => + a.trim() !== "" + ); + try { const result = await execProcess( { cmd: [ await rBinaryPath("Rscript"), + ...rscriptArgsArray, resourcePath("rmd/rmd.R"), ], cwd, diff --git a/tests/smoke/render/render-required.test.ts b/tests/smoke/render/render-required.test.ts deleted file mode 100644 index 4cb83d36bb3..00000000000 --- a/tests/smoke/render/render-required.test.ts +++ /dev/null @@ -1,50 +0,0 @@ -/* -* render-callout.test.ts -* -* Copyright (C) 2020-2022 Posit Software, PBC -* -*/ - -import { testQuartoCmd } from "../../test.ts"; -import { docs } from "../../utils.ts"; -import { printsMessage } from "../../verify.ts"; - -const input = docs("quarto-required.qmd"); - -testQuartoCmd( - "render", - [input], - [printsMessage("ERROR", /does not satisfy version/)] -); - -let oldVersionRequirement: string | undefined; -let originalDenoExit: typeof Deno.exit; - -testQuartoCmd( - "render", - [input, "--to", "html+norequire"], - [printsMessage("ERROR", /does not meet semver requirement/)], - { - setup: async () => { - // Save current version of QUARTO_VERSION_REQUIREMENT env var and set it to a value that will not be satisfied - oldVersionRequirement = Deno.env.get("QUARTO_VERSION_REQUIREMENT"); - Deno.env.set("QUARTO_VERSION_REQUIREMENT", "< 0.0.0"); - // Mock Deno.exit to throw an error instead of exiting - // Otherwise we would not check the error assertion - originalDenoExit = Deno.exit; - Deno.exit = (code?: number) => { - throw new Error(`Deno.exit called with code: ${code}`); - }; - }, - teardown: async () => { - // Restore QUARTO_VERSION_REQUIREMENT - if (oldVersionRequirement) { - Deno.env.set("QUARTO_VERSION_REQUIREMENT", oldVersionRequirement); - } else { - Deno.env.delete("QUARTO_VERSION_REQUIREMENT"); - } - // Restore Deno.exit - Deno.exit = originalDenoExit; - }, - } -); diff --git a/tests/utils.ts b/tests/utils.ts index 5fc579ff0a8..9808520eaa0 100644 --- a/tests/utils.ts +++ b/tests/utils.ts @@ -114,7 +114,7 @@ export function outputForInput( if (baseFormat === "revealjs") { outputExt = "html"; } - if (["commonmark", "gfm", "markdown"].some((f) => f === baseFormat)) { + if (["commonmark", "gfm", "markdown", "markdown_strict"].some((f) => f === baseFormat)) { outputExt = "md"; } if (baseFormat === "csljson") { @@ -189,4 +189,5 @@ export function fileLoader(...path: string[]) { // On Windows, `quarto.cmd` needs to be explicit in `execProcess()` export function quartoDevCmd(): string { return Deno.build.os === "windows" ? "quarto.cmd" : "quarto"; -} \ No newline at end of file +} +