File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed
Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -2,9 +2,20 @@ import chalk from 'chalk';
22
33let { write } = process . stdout ;
44process . stdout . write = msg => {
5+ // Strip + prettify console forwarded output:
56 let matches = msg . match ( / ^ L O G ( [ A - Z ] + ) : ( [ \s \S ] * ) $ / ) ;
67 if ( matches ) {
78 msg = chalk . bgBlueBright . white ( ' ' + matches [ 1 ] + ': ' ) + ' ' + chalk . blue ( matches [ 2 ] ) ;
89 }
10+
11+ // Strip browser prefix from the output since there's only one:
12+ if ( msg . match ( / ^ [ \n \s ] * H e a d l e s s C h r o m e / ) ) {
13+ let color = / \b S U C C E S S \b / . test ( msg ) ? 'greenBright' : 'magenta' ;
14+ msg = chalk [ color ] ( msg . replace ( / ^ [ \n \s ] * .* ?: / g, '' ) ) ;
15+ }
16+
17+ // Ignore total output since we only have one browser:
18+ if ( msg . match ( / \u001b \[ 3 2 m T O T A L : / ) ) return ;
19+
920 return write . call ( process . stdout , msg ) ;
1021} ;
You can’t perform that action at this time.
0 commit comments