Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
quarto-dev
GitHub Repository: quarto-dev/quarto-cli
Path: blob/main/tests/smoke/render/render-verapdf.test.ts
12925 views
1
/*
2
* render-verapdf.test.ts
3
*
4
* Copyright (C) 2020-2022 Posit Software, PBC
5
*
6
* Tests for QUARTO_VERAPDF environment variable override functionality.
7
*/
8
9
import { existsSync } from "../../../src/deno_ral/fs.ts";
10
import { join } from "../../../src/deno_ral/path.ts";
11
import { quartoDataDir } from "../../../src/core/appdirs.ts";
12
import { isWindows } from "../../../src/deno_ral/platform.ts";
13
import { docs } from "../../utils.ts";
14
import { printsMessage } from "../../verify.ts";
15
import { testRender } from "./render.ts";
16
17
// Test that QUARTO_VERAPDF override is logged and validation runs correctly
18
// Uses ua-missing-title.qmd which should produce a validation warning
19
const input = docs("smoke-all/pdf-standard/ua-missing-title.qmd");
20
21
// Point QUARTO_VERAPDF to the installed script to test the override path
22
const verapdfDir = quartoDataDir("verapdf");
23
const verapdfScript = isWindows
24
? join(verapdfDir, "verapdf.bat")
25
: join(verapdfDir, "verapdf");
26
27
testRender(input, "pdf", true, [
28
// Verify the QUARTO_VERAPDF override message is logged
29
printsMessage({
30
level: "INFO",
31
regex: /Using QUARTO_VERAPDF:.*verapdf/,
32
}),
33
// Verify that validation actually ran and caught the missing title
34
printsMessage({
35
level: "WARN",
36
regex: /PDF validation failed for ua-2/,
37
}),
38
], {
39
prereq: async () => {
40
// Skip if verapdf not installed
41
return existsSync(verapdfScript);
42
},
43
env: {
44
QUARTO_VERAPDF: verapdfScript,
45
},
46
});
47
48