From b328ad98fabb0c1f4002256217ccad3c1f2c124d Mon Sep 17 00:00:00 2001 From: maashkinoozhe Date: Thu, 29 Oct 2026 22:52:29 +0100 Subject: [PATCH] Moments test waits for the server to exit before removing its folder Co-Authored-By: Claude Opus 5.5 --- test/moments.test.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/moments.test.js b/test/moments.test.js index 7cacfc9..16021d6 100644 --- a/test/moments.test.js +++ b/test/moments.test.js @@ -143,7 +143,8 @@ test('moments are private, validated, editable and survive page renumbering as " assert.equal((await post(alice, '/api/moments/delete', { id: spread.id })).status, 200); assert.equal((await get(alice, '/api/moments?m=Moon%20Garden')).moments.length, 1); } finally { - if (child) child.kill(); + // The server writes db.json on SIGTERM; removing the folder before it exits races that write. + if (child && child.exitCode === null) await new Promise(resolve => { child.once('exit', resolve); child.kill(); }); fs.rmSync(root, { recursive: true, force: true }); } });