From 8fea03f408479b15fd465240e1a8d84f4ae6c9a2 Mon Sep 17 00:00:00 2001 From: Christophe Dervieux Date: Thu, 23 Jul 2026 14:37:09 +0200 Subject: [PATCH] Log smoke-all cleanup only on actual file removal postRenderCleanupFiles is a module-global list swept by every render teardown. With the log statement outside the existence check, every teardown printed a "Cleaning up" line for each registered file whether or not it existed in that teardown's scope. Across a full serial run (~10 registered files x ~1600 teardowns) this emitted ~16k lines, almost all describing removals that never happened. Moving the log inside the safeExistsSync branch prints it only when a file is actually removed. Same files removed as before; only log frequency changes. --- tests/smoke/smoke-all.test.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/smoke/smoke-all.test.ts b/tests/smoke/smoke-all.test.ts index 1172d2f13e..32b0c69d14 100644 --- a/tests/smoke/smoke-all.test.ts +++ b/tests/smoke/smoke-all.test.ts @@ -158,7 +158,10 @@ interface QuartoInlineTestSpec { verifyFns: Verify[]; } -// Functions to cleanup leftover testing +// Functions to cleanup leftover testing. +// postRenderCleanupFiles is a module-global list swept by EVERY render +// teardown, so a registered entry only logs/removes at the teardowns where the +// file actually exists (its owning document), not on every subsequent teardown. const postRenderCleanupFiles: string[] = []; function registerPostRenderCleanupFile(file: string): void { postRenderCleanupFiles.push(file); @@ -168,8 +171,8 @@ const postRenderCleanup = () => { return; } for (const file of postRenderCleanupFiles) { - console.log(`Cleaning up ${file} in ${Deno.cwd()}`); if (safeExistsSync(file)) { + console.log(`Cleaning up ${file} in ${Deno.cwd()}`); // recursive so a registered entry can be a directory (e.g. an embedded // notebook's `*_files` support dir), not just a single file safeRemoveSync(file, { recursive: true });