|
| 1 | +/* |
| 2 | +* render-output-dir.test.ts |
| 3 | +* |
| 4 | +* Test for Windows file locking issue with --output-dir flag |
| 5 | +* Regression test for: https://github.com/quarto-dev/quarto-cli/issues/XXXXX |
| 6 | +* |
| 7 | +* Copyright (C) 2020-2025 Posit Software, PBC |
| 8 | +* |
| 9 | +*/ |
| 10 | +import { dirname, join } from "../../../src/deno_ral/path.ts"; |
| 11 | +import { existsSync, safeRemoveSync } from "../../../src/deno_ral/fs.ts"; |
| 12 | +import { docs } from "../../utils.ts"; |
| 13 | +import { isWindows } from "../../../src/deno_ral/platform.ts"; |
| 14 | +import { pathDoNotExists } from "../../verify.ts"; |
| 15 | +import { testRender } from "./render.ts"; |
| 16 | + |
| 17 | +if (isWindows) { |
| 18 | + const inputDir = docs("render-output-dir/"); |
| 19 | + const quartoDir = ".quarto" |
| 20 | + const outputDir = "output-test-dir" |
| 21 | + |
| 22 | + testRender( |
| 23 | + "test.qmd", |
| 24 | + "html", |
| 25 | + true, |
| 26 | + [pathDoNotExists(quartoDir)], |
| 27 | + { |
| 28 | + cwd: () => inputDir, |
| 29 | + setup: async () => { |
| 30 | + // Ensure output and quarto dirs are removed before test |
| 31 | + if (existsSync(outputDir)) { |
| 32 | + safeRemoveSync(outputDir, { recursive: true }); |
| 33 | + } |
| 34 | + if (existsSync(quartoDir)) { |
| 35 | + safeRemoveSync(quartoDir, { recursive: true }); |
| 36 | + } |
| 37 | + }, |
| 38 | + teardown: async () => { |
| 39 | + if (existsSync(outputDir)) { |
| 40 | + safeRemoveSync(outputDir, { recursive: true }); |
| 41 | + } |
| 42 | + if (existsSync(quartoDir)) { |
| 43 | + safeRemoveSync(quartoDir, { recursive: true }); |
| 44 | + } |
| 45 | + }, |
| 46 | + }, |
| 47 | + ["--output-dir", outputDir], |
| 48 | + outputDir, |
| 49 | + ); |
| 50 | +} |
0 commit comments