Path: blob/main/tests/smoke/render/render-verapdf.test.ts
12921 views
/*1* render-verapdf.test.ts2*3* Copyright (C) 2020-2022 Posit Software, PBC4*5* Tests for QUARTO_VERAPDF environment variable override functionality.6*/78import { existsSync } from "../../../src/deno_ral/fs.ts";9import { join } from "../../../src/deno_ral/path.ts";10import { quartoDataDir } from "../../../src/core/appdirs.ts";11import { isWindows } from "../../../src/deno_ral/platform.ts";12import { docs } from "../../utils.ts";13import { printsMessage } from "../../verify.ts";14import { testRender } from "./render.ts";1516// Test that QUARTO_VERAPDF override is logged and validation runs correctly17// Uses ua-missing-title.qmd which should produce a validation warning18const input = docs("smoke-all/pdf-standard/ua-missing-title.qmd");1920// Point QUARTO_VERAPDF to the installed script to test the override path21const verapdfDir = quartoDataDir("verapdf");22const verapdfScript = isWindows23? join(verapdfDir, "verapdf.bat")24: join(verapdfDir, "verapdf");2526testRender(input, "pdf", true, [27// Verify the QUARTO_VERAPDF override message is logged28printsMessage({29level: "INFO",30regex: /Using QUARTO_VERAPDF:.*verapdf/,31}),32// Verify that validation actually ran and caught the missing title33printsMessage({34level: "WARN",35regex: /PDF validation failed for ua-2/,36}),37], {38prereq: async () => {39// Skip if verapdf not installed40return existsSync(verapdfScript);41},42env: {43QUARTO_VERAPDF: verapdfScript,44},45});464748