@@ -2,32 +2,36 @@ import * as React from 'react';
2
2
import { Box , Color , ColorProps } from 'ink' ;
3
3
import { TestResult } from '@jest/test-result' ;
4
4
import { Config } from '@jest/types' ;
5
+ import chalk from 'chalk' ;
5
6
import slash from 'slash' ;
6
7
import { relativePath } from './utils' ;
7
8
8
9
export const Arrow : React . FC = ( ) => < > { ' \u203A ' } </ > ;
9
10
export const Dot : React . FC = ( ) => < > { ' \u2022 ' } </ > ;
10
11
export const DownArrow : React . FC = ( ) => < > { ' \u21B3 ' } </ > ;
11
12
13
+ const pad = ( string : string ) => ( chalk . supportsColor ? ` ${ string } ` : string ) ;
14
+
12
15
const PaddedColor : React . FC < ColorProps > = ( { children, ...props } ) => (
13
16
< Box paddingRight = { 1 } >
14
- < Color { ...props } >
15
-
16
- { children }
17
-
18
- </ Color >
17
+ < Color { ...props } > { children } </ Color >
19
18
</ Box >
20
19
) ;
21
20
22
- const Status : React . FC < ColorProps > = props => (
23
- < PaddedColor inverse bold { ...props } />
21
+ const Status : React . FC < ColorProps & { text : string } > = ( {
22
+ text,
23
+ ...props
24
+ } ) => (
25
+ < PaddedColor inverse bold { ...props } >
26
+ { pad ( text ) }
27
+ </ PaddedColor >
24
28
) ;
25
29
26
- const Fails : React . FC = ( ) => < Status red > FAIL</ Status > ;
30
+ const Fails : React . FC = ( ) => < Status red text = " FAIL" / >;
27
31
28
- const Pass : React . FC = ( ) => < Status green > PASS</ Status > ;
32
+ const Pass : React . FC = ( ) => < Status green text = " PASS" / >;
29
33
30
- export const Runs : React . FC = ( ) => < Status yellow > RUNS</ Status > ;
34
+ export const Runs : React . FC = ( ) => < Status yellow text = " RUNS" / >;
31
35
32
36
export const DisplayName : React . FC < {
33
37
config : Config . ProjectConfig ;
0 commit comments