Skip to content

Commit e846425

Browse files
committed
Add a test for the environment variable QUARTO_VERSION_REQUIREMENT
Follow up on 00249a4 which closed #10442
1 parent 00249a4 commit e846425

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

tests/docs/quarto-required.qmd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ title: Hello Callout!
33
format:
44
html:
55
quarto-required: "<= 0.0.0"
6+
html+norequire: default
67
---
78

89
This file will not be rendered as it does not respect the quarto version requirement

tests/smoke/render/render-required.test.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,26 @@ testQuartoCmd(
1616
[input],
1717
[printsMessage("ERROR", /does not satisfy version/)]
1818
);
19+
20+
let oldVersionRequirement: string | undefined;
21+
22+
testQuartoCmd(
23+
"render",
24+
[input, "--to", "html+norequire"],
25+
[printsMessage("ERROR", /does not meet semver requirement/)],
26+
{
27+
setup: async () => {
28+
// Save current version of QUARTO_VERSION_REQUIREMENT env var and set it to a value that will not be satisfied
29+
oldVersionRequirement = Deno.env.get("QUARTO_VERSION_REQUIREMENT");
30+
Deno.env.set("QUARTO_VERSION_REQUIREMENT", "< 0.0.0");
31+
},
32+
teardown: async () => {
33+
// Restore QUARTO_VERSION_REQUIREMENT
34+
if (oldVersionRequirement) {
35+
Deno.env.set("QUARTO_VERSION_REQUIREMENT", oldVersionRequirement);
36+
} else {
37+
Deno.env.delete("QUARTO_VERSION_REQUIREMENT");
38+
}
39+
},
40+
}
41+
);

0 commit comments

Comments
 (0)