Skip to content

Turn any idea, plan, or codebase into a beautiful interactive diagram. An agent skill for Claude Code, Codex, and more.

fix(test): wait for non-empty preview marker before reading it

momoyeyu6a4bfea35138
diff --git a/test/preview-force-stop.test.mjs b/test/preview-force-stop.test.mjs
index f56a7e4f..b9dfbf47 100644
--- a/test/preview-force-stop.test.mjs
+++ b/test/preview-force-stop.test.mjs
@@ -219,7 +219,10 @@ for (const window of ['snapshot', 'receipt']) {
let socket;
try {
preview = await startPreview({ ...data, type: 'architecture', open: false, deliveryCli });
- await until(() => fs.existsSync(ready), `real delivery did not reach ${window}`);
+ // existsSync can observe the marker between open() and write() completion;
+ // require a non-empty marker so the captured path is never blank.
+ await until(() => fs.existsSync(ready) && fs.statSync(ready).size > 0,
+ `real delivery did not reach ${window}`);
const staging = path.join(data.root, fs.readdirSync(data.root).find((name) => name.startsWith('.archify-preview-')));
const claimant = path.join(staging, 'claimant.txt');
fs.writeFileSync(claimant, 'unowned content');