11import * as path from 'path' ;
22import * as React from 'react' ;
3- import { Box , Color , ColorProps , Static , render , useApp , useStdout } from 'ink' ;
3+ import { Box , Static , Text , TextProps , render , useApp , useStdout } from 'ink' ;
44import slash = require( 'slash' ) ;
55import type { Config } from '@jest/types' ;
66import type { AggregatedResult , TestResult } from '@jest/test-result' ;
@@ -19,14 +19,16 @@ import { VerboseTestList } from './VerboseTests';
1919type ConsoleBuffer = NonNullable < TestResult [ 'console' ] > ;
2020type LogType = ConsoleBuffer [ 0 ] [ 'type' ] ;
2121
22- const TitleBullet = ( ) => < Color bold > ●</ Color > ;
22+ const TitleBullet = ( ) => < Text bold > ●</ Text > ;
2323
24- const ColoredConsole : React . FC < ColorProps & { type : LogType } > = ( {
25- type,
26- ...props
27- } : {
28- type : LogType ;
29- } ) => < Color yellow = { type === 'warn' } red = { type === 'error' } { ...props } /> ;
24+ const ColoredConsole : React . FC <
25+ Omit < TextProps , 'color' > & { type : LogType }
26+ > = ( { type, ...props } : { type : LogType } ) => (
27+ < Text
28+ color = { type === 'warn' ? 'yellow' : type === 'error' ? 'red' : undefined }
29+ { ...props }
30+ />
31+ ) ;
3032
3133const TestConsoleOutput = ( {
3234 console,
@@ -52,11 +54,11 @@ const TestConsoleOutput = ({
5254 < Box key = { index } flexDirection = "column" paddingBottom = { 1 } >
5355 < Box >
5456 { TITLE_INDENT } { ' ' }
55- < ColoredConsole type = { type } dim >
57+ < ColoredConsole type = { type } dimColor >
5658 console.
5759 { type }
5860 </ ColoredConsole > { ' ' }
59- < Color dim > { origin } </ Color >
61+ < Text dimColor > { origin } </ Text >
6062 </ Box >
6163 < ColoredConsole type = { type } > { message } </ ColoredConsole >
6264 </ Box >
@@ -95,8 +97,8 @@ const CompletedTests: React.FC<{
9597
9698 return (
9799 < Box paddingBottom = { 1 } flexDirection = "column" >
98- < Static >
99- { completedTests . map ( ( { testResult, config } ) => (
100+ < Static items = { completedTests } >
101+ { ( { testResult, config } ) => (
100102 < React . Fragment key = { testResult . testFilePath + config . name } >
101103 < ResultHeader config = { config } testResult = { testResult } />
102104 < VerboseTestList
@@ -114,7 +116,7 @@ const CompletedTests: React.FC<{
114116 afterUpdate = { didUpdate }
115117 />
116118 </ React . Fragment >
117- ) ) }
119+ ) }
118120 </ Static >
119121 </ Box >
120122 ) ;
@@ -231,7 +233,7 @@ const Reporter: React.FC<Props> = ({
231233 } , [ register ] ) ;
232234
233235 const { stdout } = useStdout ( ) ;
234- const width = stdout . columns ;
236+ const width = stdout ? .columns ?? 80 ;
235237
236238 const { currentTests, completedTests, aggregatedResults, done, contexts } =
237239 state ;
0 commit comments