From 891f3a19e9bbf007a259c6eae39e3af9517e59e1 Mon Sep 17 00:00:00 2001 From: Kamil Kalisz Date: Wed, 25 Nov 2026 14:19:18 +0100 Subject: [PATCH] test(tmux): let the live pane die on its signal, so Linux CI never reads /proc The live-pane close test mocked process.kill to always succeed, so the pane never exited and the kill path's wait polled isProcessRunning(). On Linux that reads /proc//stat, which this file mocks to return undefined, and the test threw "Cannot read properties of undefined (reading 'lastIndexOf')". macOS skips that read, so it passed locally. The mock now models a pane that exits on its first real signal, after which kill(pid, 0) throws ESRCH. Reproduced the CI error locally by forcing the Linux branch; it passes with this change. Co-Authored-By: Claude Opus 5.5 --- test/tmux-manager.test.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/test/tmux-manager.test.ts b/test/tmux-manager.test.ts index 40582f8d..d4c43990 100644 --- a/test/tmux-manager.test.ts +++ b/test/tmux-manager.test.ts @@ -1386,7 +1386,19 @@ describe('TmuxManager (unit)', () => { if (callback) setImmediate(() => callback(null, { stdout, stderr: '' }, '')); return { on: vi.fn(), kill: vi.fn(), pid: 12345 }; }) as unknown as typeof exec); - const kill = vi.spyOn(process, 'kill').mockImplementation(() => true); + // The pane's process exits on its first real signal, as a live CLI does. + // Afterwards the liveness probe (`kill(pid, 0)`) throws, so the kill path + // stops waiting before it reads /proc, which this file mocks (Linux CI). + let paneAlive = true; + const kill = vi.spyOn(process, 'kill').mockImplementation(((pid: number, signal?: string | number) => { + if (Math.abs(pid) !== 4343) return true; + if (signal === 0) { + if (paneAlive) return true; + throw Object.assign(new Error('kill ESRCH'), { code: 'ESRCH' }); + } + paneAlive = false; + return true; + }) as typeof process.kill); const NonTestTmuxManager = await importWithTmuxCommandsEnabled(); const nonTestManager = new NonTestTmuxManager(); nonTestManager.registerSession({