@@ -17,6 +17,9 @@ import {
1717 isTmuxHealthy ,
1818} from '../../src/lib/tmux' ;
1919
20+ const hasTmux = await isTmuxHealthy ( ) ;
21+ const tmuxIt = hasTmux ? it : it . skip ;
22+
2023describe ( 'tmux utilities' , ( ) => {
2124 describe ( 'isTmuxAvailable' , ( ) => {
2225 it ( 'should return a boolean' , async ( ) => {
@@ -97,7 +100,7 @@ describe('tmux utilities', () => {
97100 } ) ;
98101
99102 describe ( 'createSession' , ( ) => {
100- it ( 'should accept valid options' , async ( ) => {
103+ tmuxIt ( 'should accept valid options' , async ( ) => {
101104 const result = await createSession ( {
102105 name : 'test-session-valid-xyz' ,
103106 workdir : '/tmp' ,
@@ -109,7 +112,7 @@ describe('tmux utilities', () => {
109112 } ) ;
110113
111114 describe ( 'createWindow' , ( ) => {
112- it ( 'should throw error when session does not exist' , async ( ) => {
115+ tmuxIt ( 'should throw error when session does not exist' , async ( ) => {
113116 await expect (
114117 createWindow ( {
115118 session : 'nonexistent-session-xyz' ,
@@ -121,14 +124,14 @@ describe('tmux utilities', () => {
121124 } ) ;
122125
123126 describe ( 'sessionExists' , ( ) => {
124- it ( 'should return false for nonexistent session' , async ( ) => {
127+ tmuxIt ( 'should return false for nonexistent session' , async ( ) => {
125128 const result = await sessionExists ( 'nonexistent-session-xyz-123' ) ;
126129 expect ( result ) . toBe ( false ) ;
127130 } ) ;
128131 } ) ;
129132
130133 describe ( 'windowExists' , ( ) => {
131- it ( 'should return false for nonexistent window' , async ( ) => {
134+ tmuxIt ( 'should return false for nonexistent window' , async ( ) => {
132135 const result = await windowExists (
133136 'nonexistent-session-xyz' ,
134137 'nonexistent-window'
@@ -138,54 +141,54 @@ describe('tmux utilities', () => {
138141 } ) ;
139142
140143 describe ( 'killSession' , ( ) => {
141- it ( 'should throw error when session does not exist' , async ( ) => {
144+ tmuxIt ( 'should throw error when session does not exist' , async ( ) => {
142145 await expect (
143146 killSession ( 'nonexistent-session-xyz-123' )
144147 ) . rejects . toThrow ( ) ;
145148 } ) ;
146149 } ) ;
147150
148151 describe ( 'killWindow' , ( ) => {
149- it ( 'should throw error when window does not exist' , async ( ) => {
152+ tmuxIt ( 'should throw error when window does not exist' , async ( ) => {
150153 await expect (
151154 killWindow ( 'nonexistent-session-xyz' , 'nonexistent-window' )
152155 ) . rejects . toThrow ( ) ;
153156 } ) ;
154157 } ) ;
155158
156159 describe ( 'capturePane' , ( ) => {
157- it ( 'should throw error for invalid target' , async ( ) => {
160+ tmuxIt ( 'should throw error for invalid target' , async ( ) => {
158161 await expect (
159162 capturePane ( 'nonexistent-session-xyz:0' )
160163 ) . rejects . toThrow ( ) ;
161164 } ) ;
162165 } ) ;
163166
164167 describe ( 'sendKeys' , ( ) => {
165- it ( 'should throw error for invalid target' , async ( ) => {
168+ tmuxIt ( 'should throw error for invalid target' , async ( ) => {
166169 await expect (
167170 sendKeys ( 'nonexistent-session-xyz:0' , 'echo test' )
168171 ) . rejects . toThrow ( ) ;
169172 } ) ;
170173 } ) ;
171174
172175 describe ( 'setPaneDiedHook' , ( ) => {
173- it ( 'should throw error for invalid target' , async ( ) => {
176+ tmuxIt ( 'should throw error for invalid target' , async ( ) => {
174177 await expect (
175178 setPaneDiedHook ( 'nonexistent-session-xyz:0' , 'echo done' )
176179 ) . rejects . toThrow ( ) ;
177180 } ) ;
178181 } ) ;
179182
180183 describe ( 'getPanePid' , ( ) => {
181- it ( 'should return undefined for invalid target' , async ( ) => {
184+ tmuxIt ( 'should return undefined for invalid target' , async ( ) => {
182185 const result = await getPanePid ( 'nonexistent-session-xyz:0' ) ;
183186 expect ( result ) . toBeUndefined ( ) ;
184187 } ) ;
185188 } ) ;
186189
187190 describe ( 'isPaneRunning' , ( ) => {
188- it ( 'should return false when tmux reports pane not found' , async ( ) => {
191+ tmuxIt ( 'should return false when tmux reports pane not found' , async ( ) => {
189192 const result = await isPaneRunning ( 'nonexistent-session-xyz:0' ) ;
190193 expect ( result ) . toBe ( false ) ;
191194 } ) ;
0 commit comments