Skip to content

Commit ee1ad25

Browse files
cliffhallclaude
andcommitted
test(filesystem): wait for the stale initial answer before teardown
The failed-overtaking-refresh test returned right after releasing the held initial roots/list, so its answer handling and root validation could race afterEach's teardown. Wait for the stale answer to be discarded first (Copilot on #5099). Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: cliffhall <[email protected]>
1 parent c88c3bf commit ee1ad25

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

‎src/filesystem/__tests__/server-roots.test.ts‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,13 @@ describe("roots/list_changed", () => {
493493
// Asked while the initial roots/list is still unanswered: the failed update
494494
// releases waiting calls instead of leaving them blocked on it.
495495
expect(await allowedDirectoriesOf(client)).toEqual([cliDir]);
496+
// Let the stale initial answer finish before teardown removes its roots.
496497
releaseInitial();
498+
await vi.waitFor(() =>
499+
expect(stderr).toHaveBeenCalledWith(
500+
"Discarded a stale roots/list answer: a newer roots update has started",
501+
),
502+
);
497503
});
498504

499505
it("logs and keeps the current directories when the re-fetch fails", async () => {

0 commit comments

Comments
 (0)