diff --git a/src/main/runtime/runtime-local-worktree-create.test.ts b/src/main/runtime/runtime-local-worktree-create.test.ts index a1a350fe76c..b53252d47ce 100644 --- a/src/main/runtime/runtime-local-worktree-create.test.ts +++ b/src/main/runtime/runtime-local-worktree-create.test.ts @@ -132,9 +132,11 @@ describe('runtime concurrent creates on one name', () => { { request: { name: 'nautilus', nameWasGenerated: true }, second: null } ])('gives the second create of $request.name its next candidate', async ({ request, second }) => { await Promise.all([createWorktree(request), createWorktree(request)]) - const [first, other] = addedPaths().map((path) => basename(path)) - expect(first).toBe(request.name) - expect(other).not.toBe(first) + // Claims are ordered, but each create resolves its path's realpath before Git's add, so on a + // loaded runner either create can reach add first. Check the names, not the call order. + const names = addedPaths().map((path) => basename(path)) + expect(names.filter((name) => name === request.name)).toHaveLength(1) + const other = names.find((name) => name !== request.name) ?? '' if (second) { expect(other).toBe(second) } else {