From 3a7e216b7dc48496a6f7bb0ef26d47ad5d85309f Mon Sep 17 00:00:00 2001 From: "paseo-bot[bot]" <266920839+paseo-bot[bot]@users.noreply.github.com> Date: Mon, 16 Nov 2026 18:45:26 +0000 Subject: [PATCH] test(server): read the latest event when checking a removed file on macOS (#9898) macOS FSEvents can replay the file's pre-subscription write as a create after the observer starts. The test read the first event for the path, so it stayed on that create after the delete arrived in a later batch. Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 --- packages/server/src/server/file-observer/index.test.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/server/src/server/file-observer/index.test.ts b/packages/server/src/server/file-observer/index.test.ts index 92cb5bced..cf481b6e0 100644 --- a/packages/server/src/server/file-observer/index.test.ts +++ b/packages/server/src/server/file-observer/index.test.ts @@ -193,10 +193,11 @@ test("classifies a removed file as deleted", async () => { }); await rm(target); - // Native recursive delivery can be coalesced before the backend's deletion audit. - // Assert eventual classification without imposing Vitest's one-second default. + // macOS FSEvents can replay the write above as a create after the subscription starts, + // so the delete is the latest event for the path, not the first. Native recursive delivery + // can also be coalesced before the backend's deletion audit, hence the longer timeout. await expect - .poll(() => events.find((event) => event.path === target)?.type, { timeout: 10_000 }) + .poll(() => events.findLast((event) => event.path === target)?.type, { timeout: 10_000 }) .toBe("delete"); await subscription.unsubscribe(); });