@@ -565,43 +565,64 @@ export const examples: {[key in string]: Example} = {
565565 renderTasks : {
566566 type : 'async' ,
567567 basic : async ( ) => {
568- const stdout = new Stdout ( { columns : TERMINAL_WIDTH } )
568+ // Force colors for deterministic output (solid blocks vs animated wave)
569+ const originalForceColor = process . env . FORCE_COLOR
570+ process . env . FORCE_COLOR = '1'
571+ try {
572+ const stdout = new Stdout ( { columns : TERMINAL_WIDTH } )
569573
570- const tasks = [
571- {
572- title : 'Installing dependencies' ,
573- task : async ( ) => {
574- await new Promise ( ( resolve ) => setTimeout ( resolve , 2000 ) )
574+ const tasks = [
575+ {
576+ title : 'Installing dependencies' ,
577+ task : async ( ) => {
578+ await new Promise ( ( resolve ) => setTimeout ( resolve , 2000 ) )
579+ } ,
575580 } ,
576- } ,
577- ]
578-
579- renderTasks ( tasks , { renderOptions : { stdout : stdout as any , debug : true } } )
580-
581- await waitFor (
582- ( ) => { } ,
583- ( ) => Boolean ( stdout . lastFrame ( ) ?. includes ( 'Installing dependencies' ) ) ,
584- )
585-
586- // Return first frame with the title for deterministic output
587- return stdout . frames . find ( ( frame ) => frame . includes ( 'Installing dependencies' ) ) !
581+ ]
582+
583+ renderTasks ( tasks , { renderOptions : { stdout : stdout as any , debug : true } } )
584+
585+ await waitFor (
586+ ( ) => { } ,
587+ ( ) => Boolean ( stdout . lastFrame ( ) ?. includes ( 'Installing dependencies' ) ) ,
588+ )
589+
590+ return stdout . lastFrame ( ) !
591+ } finally {
592+ if ( originalForceColor === undefined ) {
593+ delete process . env . FORCE_COLOR
594+ } else {
595+ process . env . FORCE_COLOR = originalForceColor
596+ }
597+ }
588598 } ,
589599 } ,
590600 renderSingleTask : {
591601 type : 'async' ,
592602 basic : async ( ) => {
593- const stdout = new Stdout ( { columns : TERMINAL_WIDTH } )
594-
595- await renderSingleTask ( {
596- title : outputContent `Loading app` ,
597- task : async ( ) => {
598- await sleep ( 1 )
599- } ,
600- renderOptions : { stdout : stdout as any , debug : true } ,
601- } )
602-
603- // Return first frame with the title for deterministic output
604- return stdout . frames . find ( ( frame ) => frame . includes ( 'Loading' ) ) !
603+ // Force colors for deterministic output (solid blocks vs animated wave)
604+ const originalForceColor = process . env . FORCE_COLOR
605+ process . env . FORCE_COLOR = '1'
606+ try {
607+ const stdout = new Stdout ( { columns : TERMINAL_WIDTH } )
608+
609+ await renderSingleTask ( {
610+ title : outputContent `Loading app` ,
611+ task : async ( ) => {
612+ await sleep ( 1 )
613+ } ,
614+ renderOptions : { stdout : stdout as any , debug : true } ,
615+ } )
616+
617+ // Return first frame with the title for deterministic output
618+ return stdout . frames . find ( ( frame ) => frame . includes ( 'Loading' ) ) !
619+ } finally {
620+ if ( originalForceColor === undefined ) {
621+ delete process . env . FORCE_COLOR
622+ } else {
623+ process . env . FORCE_COLOR = originalForceColor
624+ }
625+ }
605626 } ,
606627 } ,
607628 renderTextPrompt : {
0 commit comments