@@ -888,7 +888,7 @@ export const runTestCase = async (
888
888
889
889
const onOutput = (
890
890
name : string ,
891
- onLine : ( line : string ) => void ,
891
+ onLine : ( line : string , now : Date ) => void ,
892
892
escapeDebugOutput : boolean
893
893
) : ( ( data : Buffer ) => void ) => {
894
894
const debugExt = debug . extend ( name ) ;
@@ -899,12 +899,13 @@ export const runTestCase = async (
899
899
// Don't eat the last line of output.
900
900
cypressChild . on ( "exit" , ( ) => {
901
901
if ( pending . s !== "" ) {
902
- onLine ( pending . s ) ;
902
+ onLine ( pending . s , new Date ( ) ) ;
903
903
debugExt ( escapeDebugOutput ? JSON . stringify ( pending . s ) : pending . s ) ;
904
904
}
905
905
} ) ;
906
906
907
907
return ( data : Buffer ) : void => {
908
+ const now = new Date ( ) ;
908
909
// In case data terminates in the middle of a Unicode sequence, we need to use a stateful
909
910
// TextDecoder with `stream: true`. Otherwise, invalid UTF-8 sequences at the end get
910
911
// converted to 0xFFFD, which breaks the tests non-deterministically (i.e., makes them flaky).
@@ -914,7 +915,7 @@ export const runTestCase = async (
914
915
// partial line that we want to defer until the next call.
915
916
lines . slice ( 0 , lines . length - 1 ) . forEach ( ( line , idx ) => {
916
917
const lineWithPending = idx === 0 ? pending . s + line : line ;
917
- onLine ( lineWithPending ) ;
918
+ onLine ( lineWithPending , now ) ;
918
919
debugExt (
919
920
escapeDebugOutput ? JSON . stringify ( lineWithPending ) : lineWithPending
920
921
) ;
@@ -931,7 +932,9 @@ export const runTestCase = async (
931
932
"data" ,
932
933
onOutput (
933
934
"stderr" ,
934
- combinedLines . push . bind ( combinedLines ) ,
935
+ ( line , now ) => {
936
+ combinedLines . push ( `${ now . toISOString ( ) } ${ line } ` ) ;
937
+ } ,
935
938
// Don't escape stderr output since it likely comes from debug output in the subprocess, which
936
939
// is intended for human consumption and not for verifying test results.
937
940
false
@@ -941,9 +944,9 @@ export const runTestCase = async (
941
944
"data" ,
942
945
onOutput (
943
946
"stdout" ,
944
- ( line ) => {
947
+ ( line , now ) => {
945
948
stdoutLines . push ( line ) ;
946
- combinedLines . push ( line ) ;
949
+ combinedLines . push ( ` ${ now . toISOString ( ) } ${ line } ` ) ;
947
950
} ,
948
951
// Escape special characters in debug output so that we can more easily understand test
949
952
// failures related to unexpected output.
0 commit comments