@@ -33,7 +33,8 @@ const STDOUT_WHITE_LIST = [
3333 "\x1B[1;33mERROR\x1B[0m" ,
3434 "\x1B[1;32m\x1B[40mWARN\x1B[0m" ,
3535 "Test Suite" ,
36- "✖"
36+ "✖" ,
37+ "✔"
3738] ;
3839
3940// we slice the VERBOSE nighwatch stdout stream on the purple INFO text that has black background
@@ -58,6 +59,24 @@ module.exports = class ChildProcess {
5859 transform ( data , encoding , callback ) {
5960 let text = data . toString ( ) . trim ( ) ;
6061 if ( text . length > 0 && self . isTextWhiteListed ( text ) ) {
62+ if ( ! process . env . DEBUG && text . includes ( "✔" ) ) {
63+ // for successful chunks we really only want to keep specific lines
64+ const lines = text . split ( "\n" ) ;
65+ const buff = [ ] ;
66+ const startsWithTerms = [ "Running:" , " ✔" , "OK." ] ;
67+ const maxLineLength = 512 ;
68+ const processLine = ( line ) => {
69+ for ( const term of startsWithTerms ) {
70+ // line could have an ERROR or WARN tag that is whitelisted we want to keep
71+ if ( self . isTextWhiteListed ( line ) || line . startsWith ( term ) ) {
72+ // limit the length of each line, goal here is to "limit" verbosity
73+ buff . push ( line . substring ( 0 , maxLineLength ) ) ;
74+ }
75+ }
76+ } ;
77+ lines . forEach ( line => processLine ( line ) ) ;
78+ text = buff . join ( "\n" ) ;
79+ }
6180 text = text
6281 . split ( "\n" )
6382 . filter ( ( line ) => ! _ . isEmpty ( line . trim ( ) ) )
@@ -74,6 +93,7 @@ module.exports = class ChildProcess {
7493 this . emitter = new EventEmitter ( ) ;
7594 this . emitter . stdout = stdoutFilter ;
7695 this . emitter . stderr = handler . stderr ;
96+ this . emitter . infoSlicer = infoSlicer ;
7797
7898 // pipe the stdout stream into the slicer and then into the filter
7999 this . handler . stdout . pipe ( infoSlicer ) . pipe ( stdoutFilter ) ;
0 commit comments