Skip to content

Commit f8368cf

Browse files
committed
tests: clean prepost artifacts in setup so verifyPath proves creation
project-prepost.test.ts checks that i-was-created.txt (extension) and input-files.txt/output-files.txt (issue-10828) exist after render, but only removed them in teardown. Those are fixed repo paths, so a run that crashes between creating them and teardown leaves a stale copy — after which a regression that stops the render creating them still passes verifyPath. Add setup cleanup (matching the safeRemoveIfExists the file already uses in teardown) so each verifyPath proves this render wrote the file, not a leftover. Also clears i-exist.txt up front so pre-render's "must not exist" guard starts clean after a prior crashed run.
1 parent 2d99991 commit f8368cf

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

tests/smoke/project/project-prepost.test.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,13 @@ testQuartoCmd(
7474
}
7575
}],
7676
{
77+
// remove artifacts a prior crashed run may have left behind, so verifyPath
78+
// proves this render created i-was-created.txt (not a stale copy) and
79+
// pre-render's i-exist.txt guard starts from a clean slate
80+
setup: async () => {
81+
safeRemoveIfExists(join(docs("project/prepost/extension"), "i-was-created.txt"));
82+
safeRemoveIfExists(join(docs("project/prepost/extension"), "i-exist.txt"));
83+
},
7784
teardown: async () => {
7885
safeRemoveIfExists(join(docs("project/prepost/extension"), "i-was-created.txt"));
7986
const siteDir = join(docs("project/prepost/extension"), "_site");
@@ -100,6 +107,12 @@ testQuartoCmd(
100107
"QUARTO_USE_FILE_FOR_PROJECT_INPUT_FILES": normalizePath(docs("project/prepost/issue-10828/input-files.txt")),
101108
"QUARTO_USE_FILE_FOR_PROJECT_OUTPUT_FILES": normalizePath(docs("project/prepost/issue-10828/output-files.txt"))
102109
},
110+
// remove artifacts a prior crashed run may have left behind, so verifyPath
111+
// proves this render wrote input-files.txt/output-files.txt, not a stale copy
112+
setup: async () => {
113+
safeRemoveIfExists(normalizePath(docs("project/prepost/issue-10828/input-files.txt")));
114+
safeRemoveIfExists(normalizePath(docs("project/prepost/issue-10828/output-files.txt")));
115+
},
103116
teardown: async () => {
104117
safeRemoveIfExists(normalizePath(docs("project/prepost/issue-10828/input-files.txt")));
105118
safeRemoveIfExists(normalizePath(docs("project/prepost/issue-10828/output-files.txt")));

0 commit comments

Comments
 (0)