@@ -184,7 +184,10 @@ describe('stdio/stdout', () => {
184184 } )
185185
186186 it ( 'should clear line in TTY' , ( ) => {
187- Object . defineProperty ( stdout , 'isTTY' , { value : true , configurable : true } )
187+ Object . defineProperty ( stdout , 'isTTY' , {
188+ value : true ,
189+ configurable : true ,
190+ } )
188191 clearLine ( )
189192 expect ( cursorToSpy ) . toHaveBeenCalledWith ( 0 )
190193 expect ( clearLineSpy ) . toHaveBeenCalledWith ( 0 )
@@ -201,13 +204,19 @@ describe('stdio/stdout', () => {
201204 } )
202205
203206 it ( 'should not return a value' , ( ) => {
204- Object . defineProperty ( stdout , 'isTTY' , { value : true , configurable : true } )
207+ Object . defineProperty ( stdout , 'isTTY' , {
208+ value : true ,
209+ configurable : true ,
210+ } )
205211 const result = clearLine ( )
206212 expect ( result ) . toBeUndefined ( )
207213 } )
208214
209215 it ( 'should move cursor to start of line before clearing' , ( ) => {
210- Object . defineProperty ( stdout , 'isTTY' , { value : true , configurable : true } )
216+ Object . defineProperty ( stdout , 'isTTY' , {
217+ value : true ,
218+ configurable : true ,
219+ } )
211220 clearLine ( )
212221 expect ( cursorToSpy ) . toHaveBeenCalledBefore ( clearLineSpy )
213222 } )
@@ -219,19 +228,28 @@ describe('stdio/stdout', () => {
219228 } )
220229
221230 it ( 'should move cursor to x position in TTY' , ( ) => {
222- Object . defineProperty ( stdout , 'isTTY' , { value : true , configurable : true } )
231+ Object . defineProperty ( stdout , 'isTTY' , {
232+ value : true ,
233+ configurable : true ,
234+ } )
223235 cursorTo ( 10 )
224236 expect ( cursorToSpy ) . toHaveBeenCalledWith ( 10 , undefined )
225237 } )
226238
227239 it ( 'should move cursor to x,y position in TTY' , ( ) => {
228- Object . defineProperty ( stdout , 'isTTY' , { value : true , configurable : true } )
240+ Object . defineProperty ( stdout , 'isTTY' , {
241+ value : true ,
242+ configurable : true ,
243+ } )
229244 cursorTo ( 10 , 5 )
230245 expect ( cursorToSpy ) . toHaveBeenCalledWith ( 10 , 5 )
231246 } )
232247
233248 it ( 'should move cursor to 0,0' , ( ) => {
234- Object . defineProperty ( stdout , 'isTTY' , { value : true , configurable : true } )
249+ Object . defineProperty ( stdout , 'isTTY' , {
250+ value : true ,
251+ configurable : true ,
252+ } )
235253 cursorTo ( 0 , 0 )
236254 expect ( cursorToSpy ) . toHaveBeenCalledWith ( 0 , 0 )
237255 } )
@@ -246,19 +264,28 @@ describe('stdio/stdout', () => {
246264 } )
247265
248266 it ( 'should not return a value' , ( ) => {
249- Object . defineProperty ( stdout , 'isTTY' , { value : true , configurable : true } )
267+ Object . defineProperty ( stdout , 'isTTY' , {
268+ value : true ,
269+ configurable : true ,
270+ } )
250271 const result = cursorTo ( 0 )
251272 expect ( result ) . toBeUndefined ( )
252273 } )
253274
254275 it ( 'should handle large coordinates' , ( ) => {
255- Object . defineProperty ( stdout , 'isTTY' , { value : true , configurable : true } )
276+ Object . defineProperty ( stdout , 'isTTY' , {
277+ value : true ,
278+ configurable : true ,
279+ } )
256280 cursorTo ( 1000 , 500 )
257281 expect ( cursorToSpy ) . toHaveBeenCalledWith ( 1000 , 500 )
258282 } )
259283
260284 it ( 'should handle negative coordinates' , ( ) => {
261- Object . defineProperty ( stdout , 'isTTY' , { value : true , configurable : true } )
285+ Object . defineProperty ( stdout , 'isTTY' , {
286+ value : true ,
287+ configurable : true ,
288+ } )
262289 cursorTo ( - 1 , - 1 )
263290 expect ( cursorToSpy ) . toHaveBeenCalledWith ( - 1 , - 1 )
264291 } )
@@ -270,7 +297,10 @@ describe('stdio/stdout', () => {
270297 } )
271298
272299 it ( 'should clear screen down in TTY' , ( ) => {
273- Object . defineProperty ( stdout , 'isTTY' , { value : true , configurable : true } )
300+ Object . defineProperty ( stdout , 'isTTY' , {
301+ value : true ,
302+ configurable : true ,
303+ } )
274304 clearScreenDown ( )
275305 expect ( clearScreenDownSpy ) . toHaveBeenCalled ( )
276306 } )
@@ -285,7 +315,10 @@ describe('stdio/stdout', () => {
285315 } )
286316
287317 it ( 'should not return a value' , ( ) => {
288- Object . defineProperty ( stdout , 'isTTY' , { value : true , configurable : true } )
318+ Object . defineProperty ( stdout , 'isTTY' , {
319+ value : true ,
320+ configurable : true ,
321+ } )
289322 const result = clearScreenDown ( )
290323 expect ( result ) . toBeUndefined ( )
291324 } )
@@ -297,7 +330,10 @@ describe('stdio/stdout', () => {
297330 } )
298331
299332 it ( 'should return true when stdout is TTY' , ( ) => {
300- Object . defineProperty ( stdout , 'isTTY' , { value : true , configurable : true } )
333+ Object . defineProperty ( stdout , 'isTTY' , {
334+ value : true ,
335+ configurable : true ,
336+ } )
301337 expect ( isTTY ( ) ) . toBe ( true )
302338 } )
303339
@@ -328,7 +364,10 @@ describe('stdio/stdout', () => {
328364 } )
329365
330366 it ( 'should return actual columns when set' , ( ) => {
331- Object . defineProperty ( stdout , 'columns' , { value : 120 , configurable : true } )
367+ Object . defineProperty ( stdout , 'columns' , {
368+ value : 120 ,
369+ configurable : true ,
370+ } )
332371 expect ( getColumns ( ) ) . toBe ( 120 )
333372 } )
334373
@@ -346,12 +385,18 @@ describe('stdio/stdout', () => {
346385 } )
347386
348387 it ( 'should handle small terminal width' , ( ) => {
349- Object . defineProperty ( stdout , 'columns' , { value : 40 , configurable : true } )
388+ Object . defineProperty ( stdout , 'columns' , {
389+ value : 40 ,
390+ configurable : true ,
391+ } )
350392 expect ( getColumns ( ) ) . toBe ( 40 )
351393 } )
352394
353395 it ( 'should handle large terminal width' , ( ) => {
354- Object . defineProperty ( stdout , 'columns' , { value : 300 , configurable : true } )
396+ Object . defineProperty ( stdout , 'columns' , {
397+ value : 300 ,
398+ configurable : true ,
399+ } )
355400 expect ( getColumns ( ) ) . toBe ( 300 )
356401 } )
357402
@@ -404,7 +449,10 @@ describe('stdio/stdout', () => {
404449 } )
405450
406451 it ( 'should write hide cursor sequence in TTY WriteStream' , ( ) => {
407- Object . defineProperty ( stdout , 'isTTY' , { value : true , configurable : true } )
452+ Object . defineProperty ( stdout , 'isTTY' , {
453+ value : true ,
454+ configurable : true ,
455+ } )
408456 hideCursor ( )
409457 expect ( writeSpy ) . toHaveBeenCalledWith ( '\u001B[?25l' )
410458 } )
@@ -419,7 +467,10 @@ describe('stdio/stdout', () => {
419467 } )
420468
421469 it ( 'should not return a value' , ( ) => {
422- Object . defineProperty ( stdout , 'isTTY' , { value : true , configurable : true } )
470+ Object . defineProperty ( stdout , 'isTTY' , {
471+ value : true ,
472+ configurable : true ,
473+ } )
423474 const result = hideCursor ( )
424475 expect ( result ) . toBeUndefined ( )
425476 } )
@@ -431,7 +482,10 @@ describe('stdio/stdout', () => {
431482 } )
432483
433484 it ( 'should write show cursor sequence in TTY WriteStream' , ( ) => {
434- Object . defineProperty ( stdout , 'isTTY' , { value : true , configurable : true } )
485+ Object . defineProperty ( stdout , 'isTTY' , {
486+ value : true ,
487+ configurable : true ,
488+ } )
435489 showCursor ( )
436490 expect ( writeSpy ) . toHaveBeenCalledWith ( '\u001B[?25h' )
437491 } )
@@ -446,7 +500,10 @@ describe('stdio/stdout', () => {
446500 } )
447501
448502 it ( 'should not return a value' , ( ) => {
449- Object . defineProperty ( stdout , 'isTTY' , { value : true , configurable : true } )
503+ Object . defineProperty ( stdout , 'isTTY' , {
504+ value : true ,
505+ configurable : true ,
506+ } )
450507 const result = showCursor ( )
451508 expect ( result ) . toBeUndefined ( )
452509 } )
@@ -496,7 +553,10 @@ describe('stdio/stdout', () => {
496553 } )
497554
498555 it ( 'should support clearing and rewriting' , ( ) => {
499- Object . defineProperty ( stdout , 'isTTY' , { value : true , configurable : true } )
556+ Object . defineProperty ( stdout , 'isTTY' , {
557+ value : true ,
558+ configurable : true ,
559+ } )
500560 write ( 'Processing...' )
501561 clearLine ( )
502562 write ( 'Complete!' )
@@ -506,7 +566,10 @@ describe('stdio/stdout', () => {
506566 } )
507567
508568 it ( 'should support cursor positioning and writing' , ( ) => {
509- Object . defineProperty ( stdout , 'isTTY' , { value : true , configurable : true } )
569+ Object . defineProperty ( stdout , 'isTTY' , {
570+ value : true ,
571+ configurable : true ,
572+ } )
510573 cursorTo ( 0 , 0 )
511574 write ( 'Top left' )
512575 cursorTo ( 0 , 10 )
@@ -516,7 +579,10 @@ describe('stdio/stdout', () => {
516579 } )
517580
518581 it ( 'should support hide/show cursor pattern' , ( ) => {
519- Object . defineProperty ( stdout , 'isTTY' , { value : true , configurable : true } )
582+ Object . defineProperty ( stdout , 'isTTY' , {
583+ value : true ,
584+ configurable : true ,
585+ } )
520586 hideCursor ( )
521587 write ( 'Animation frame 1' )
522588 write ( 'Animation frame 2' )
@@ -527,7 +593,10 @@ describe('stdio/stdout', () => {
527593
528594 it ( 'should handle graceful degradation from TTY to non-TTY' , ( ) => {
529595 // Start with TTY
530- Object . defineProperty ( stdout , 'isTTY' , { value : true , configurable : true } )
596+ Object . defineProperty ( stdout , 'isTTY' , {
597+ value : true ,
598+ configurable : true ,
599+ } )
531600 clearLine ( )
532601 expect ( clearLineSpy ) . toHaveBeenCalled ( )
533602
@@ -558,7 +627,7 @@ describe('stdio/stdout', () => {
558627 } )
559628
560629 it ( 'should handle very long text' , ( ) => {
561- const longText = 'x' . repeat ( 10000 )
630+ const longText = 'x' . repeat ( 10_000 )
562631 writeLine ( longText )
563632 expect ( writeSpy ) . toHaveBeenCalledWith ( `${ longText } \n` )
564633 } )
@@ -570,18 +639,27 @@ describe('stdio/stdout', () => {
570639 } )
571640
572641 it ( 'should handle rapid cursor movements' , ( ) => {
573- Object . defineProperty ( stdout , 'isTTY' , { value : true , configurable : true } )
642+ Object . defineProperty ( stdout , 'isTTY' , {
643+ value : true ,
644+ configurable : true ,
645+ } )
574646 for ( let i = 0 ; i < 100 ; i ++ ) {
575647 cursorTo ( i , i )
576648 }
577649 expect ( cursorToSpy ) . toHaveBeenCalledTimes ( 100 )
578650 } )
579651
580652 it ( 'should handle terminal dimension changes' , ( ) => {
581- Object . defineProperty ( stdout , 'columns' , { value : 80 , configurable : true } )
653+ Object . defineProperty ( stdout , 'columns' , {
654+ value : 80 ,
655+ configurable : true ,
656+ } )
582657 expect ( getColumns ( ) ) . toBe ( 80 )
583658
584- Object . defineProperty ( stdout , 'columns' , { value : 120 , configurable : true } )
659+ Object . defineProperty ( stdout , 'columns' , {
660+ value : 120 ,
661+ configurable : true ,
662+ } )
585663 expect ( getColumns ( ) ) . toBe ( 120 )
586664 } )
587665
@@ -599,18 +677,25 @@ describe('stdio/stdout', () => {
599677
600678 describe ( 'real-world usage' , ( ) => {
601679 it ( 'should support progress indicator pattern' , ( ) => {
602- Object . defineProperty ( stdout , 'isTTY' , { value : true , configurable : true } )
680+ Object . defineProperty ( stdout , 'isTTY' , {
681+ value : true ,
682+ configurable : true ,
683+ } )
603684 write ( 'Loading...' )
604685 clearLine ( )
605686 write ( 'Loading... 50%' )
606687 clearLine ( )
607688 write ( 'Loading... 100%' )
608689 writeLine ( ' Done!' )
609- expect ( writeSpy ) . toHaveBeenCalledTimes ( 7 ) // 3 writes, 2 clears (cursorTo + clearLine), 1 writeLine
690+ // Actual calls: 3 writes + 1 writeLine = 4 calls (clearLine calls cursorTo and clearLine internally but not write)
691+ expect ( writeSpy ) . toHaveBeenCalledTimes ( 4 )
610692 } )
611693
612694 it ( 'should support spinner pattern' , ( ) => {
613- Object . defineProperty ( stdout , 'isTTY' , { value : true , configurable : true } )
695+ Object . defineProperty ( stdout , 'isTTY' , {
696+ value : true ,
697+ configurable : true ,
698+ } )
614699 hideCursor ( )
615700 const frames = [ '⠋' , '⠙' , '⠹' , '⠸' ]
616701 for ( const frame of frames ) {
@@ -649,7 +734,10 @@ describe('stdio/stdout', () => {
649734 } )
650735
651736 it ( 'should handle terminal size queries' , ( ) => {
652- Object . defineProperty ( stdout , 'columns' , { value : 120 , configurable : true } )
737+ Object . defineProperty ( stdout , 'columns' , {
738+ value : 120 ,
739+ configurable : true ,
740+ } )
653741 Object . defineProperty ( stdout , 'rows' , { value : 40 , configurable : true } )
654742 const width = getColumns ( )
655743 const height = getRows ( )
0 commit comments