|
8 | 8 | isInsideTmux, |
9 | 9 | notifyTerminalOnce, |
10 | 10 | supportsOsc9Notification, |
| 11 | + supportsTerminalProgress, |
11 | 12 | } from '#/tui/utils/terminal-notification'; |
12 | 13 |
|
13 | 14 | function makeNotificationState(args: { |
@@ -215,6 +216,32 @@ describe('supportsOsc9Notification', () => { |
215 | 216 | }); |
216 | 217 | }); |
217 | 218 |
|
| 219 | +describe('supportsTerminalProgress', () => { |
| 220 | + it('detects Windows Terminal / ConEmu via env flags', () => { |
| 221 | + expect(supportsTerminalProgress({ WT_SESSION: 'abc-123' })).toBe(true); |
| 222 | + expect(supportsTerminalProgress({ ConEmuANSI: 'ON' })).toBe(true); |
| 223 | + }); |
| 224 | + |
| 225 | + it('detects Ghostty / WezTerm via TERM_PROGRAM and TERM', () => { |
| 226 | + expect(supportsTerminalProgress({ TERM_PROGRAM: 'ghostty' })).toBe(true); |
| 227 | + expect(supportsTerminalProgress({ TERM: 'xterm-ghostty' })).toBe(true); |
| 228 | + expect(supportsTerminalProgress({ TERM_PROGRAM: 'WezTerm' })).toBe(true); |
| 229 | + }); |
| 230 | + |
| 231 | + it('rejects terminals that show every OSC 9 payload as a notification', () => { |
| 232 | + // iTerm2 treats any OSC 9 payload as a desktop notification, so the |
| 233 | + // ConEmu-style 9;4 progress sequence must never be sent there. |
| 234 | + expect(supportsTerminalProgress({ TERM_PROGRAM: 'iTerm.app' })).toBe(false); |
| 235 | + expect(supportsTerminalProgress({ TERM_PROGRAM: 'Apple_Terminal' })).toBe(false); |
| 236 | + expect(supportsTerminalProgress({ TERM_PROGRAM: 'WarpTerminal' })).toBe(false); |
| 237 | + expect(supportsTerminalProgress({ TERM: 'xterm-kitty' })).toBe(false); |
| 238 | + expect(supportsTerminalProgress({ TERM: 'xterm-256color' })).toBe(false); |
| 239 | + expect(supportsTerminalProgress({ ConEmuANSI: 'OFF' })).toBe(false); |
| 240 | + expect(supportsTerminalProgress({ WT_SESSION: '' })).toBe(false); |
| 241 | + expect(supportsTerminalProgress({})).toBe(false); |
| 242 | + }); |
| 243 | +}); |
| 244 | + |
218 | 245 | describe('isInsideTmux', () => { |
219 | 246 | it('detects tmux via the TMUX env var', () => { |
220 | 247 | expect(isInsideTmux({ TMUX: '/private/tmp/tmux-501/default,1234,0' })).toBe(true); |
|
0 commit comments