Path: blob/main/tests/smoke/render/render-output-dir.test.ts
12925 views
/*1* render-output-dir.test.ts2*3* Test for Windows file locking issue with --output-dir flag4* Regression test for: https://github.com/quarto-dev/quarto-cli/issues/136255*6* Copyright (C) 2020-2025 Posit Software, PBC7*8*/9import { existsSync, safeRemoveSync } from "../../../src/deno_ral/fs.ts";10import { docs } from "../../utils.ts";11import { isWindows } from "../../../src/deno_ral/platform.ts";12import { fileExists, pathDoNotExists } from "../../verify.ts";13import { testRender } from "./render.ts";14import type { Verify } from "../../test.ts";151617const inputDir = docs("render-output-dir/");18const quartoDir = ".quarto";19const outputDir = "output-test-dir";2021const cleanupDirs = async () => {22if (existsSync(outputDir)) {23safeRemoveSync(outputDir, { recursive: true });24}25if (existsSync(quartoDir)) {26safeRemoveSync(quartoDir, { recursive: true });27}28};2930const testOutputDirRender = (31quartoVerify: Verify,32extraArgs: string[] = [],33) => {34testRender(35"test.qmd",36"html",37false,38[quartoVerify],39{40cwd: () => inputDir,41setup: cleanupDirs,42teardown: cleanupDirs,43},44["--output-dir", outputDir, ...extraArgs],45outputDir,46);47};4849// Test 1: Default behavior (clean=true) - .quarto should be removed50testOutputDirRender(pathDoNotExists(quartoDir));5152// Test 2: With --no-clean flag - .quarto should be preserved53testOutputDirRender(fileExists(quartoDir), ["--no-clean"]);545556