From e2359aa0e8fbdf2b01b196b05ecd250c6c723857 Mon Sep 17 00:00:00 2001 From: Michael Grundberg Date: Fri, 6 Nov 2026 21:13:45 +0100 Subject: [PATCH] test(files): cover the review's two remaining outside-worktree cases The symlinked .git folder test now also runs from a session in the main checkout, as well as from a linked worktree. A new pane-watcher test checks that an unparseable docker-cases.json follows nothing. Co-Authored-By: Claude Opus 5.5 --- test/live-worktree-outside.test.ts | 4 +++- test/pane-cwd-tracking.test.ts | 14 ++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/test/live-worktree-outside.test.ts b/test/live-worktree-outside.test.ts index 5f29091a..8472cb30 100644 --- a/test/live-worktree-outside.test.ts +++ b/test/live-worktree-outside.test.ts @@ -157,7 +157,9 @@ describe('findLiveWorktree outside the session folder', () => { const fake = join(base, 'fake'); mkdirSync(fake); symlinkSync(join(repo, '.git'), join(fake, '.git')); - // The session is in the linked worktree, so the main-worktree branch is the one exercised. + // From a session in the main checkout. + expect(await findLiveWorktree(repo, fake, { home })).toBeUndefined(); + // From a session in a linked worktree. expect(await findLiveWorktree(sibling, fake, { home })).toBeUndefined(); // The real main worktree is still followed from the same session. expect(await findLiveWorktree(sibling, repo, { home })).toEqual({ name: 'myapp', path: repo, outside: true }); diff --git a/test/pane-cwd-tracking.test.ts b/test/pane-cwd-tracking.test.ts index e93fad20..de02eb73 100644 --- a/test/pane-cwd-tracking.test.ts +++ b/test/pane-cwd-tracking.test.ts @@ -491,6 +491,20 @@ describe('a pane read reaching the session record', () => { } }); + it('follows nothing while docker-cases.json cannot be parsed', async () => { + const casesFile = dataPath('docker-cases.json'); + mkdirSync(dirname(casesFile), { recursive: true }); + try { + // A read that lands while the writer is rewriting the file. + writeFileSync(casesFile, '[{"hostWorkspacePath": "/hom'); + expect(await paneInSibling()).toBeUndefined(); + writeFileSync(casesFile, '[]'); + expect(await paneInSibling()).toEqual({ name: 'myapp-feature', path: sibling, outside: true }); + } finally { + rmSync(casesFile, { force: true }); + } + }); + it('applies the owner folder rule in multi-user mode', async () => { const spaces = join(base, 'spaces'); mkdirSync(spaces);