File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ const lineReader = __webpack_require__(631);
1010const fs = __webpack_require__ ( 747 ) ;
1111
1212try {
13- const regex = / [ \w \d ] + _ t e s t .g o : \d + : / iu ; // Extracts file name and line where test failures occurred
13+ const regex = / ( \s * [ \w \d ] + _ t e s t .g o : \d + : ) ( . * ? ) ( T e s t : \s + T e s t [ \w \d ] * ? % 0 A ) / gu ; // Extracts only the failure from the logs (including whitespace)
1414
1515 const testResultsPath = core . getInput ( 'test-results' ) ;
1616 const customPackageName = core . getInput ( 'package-name' ) ;
@@ -58,12 +58,12 @@ try {
5858 lr . on ( 'end' , function ( ) {
5959 for ( const [ key , value ] of Object . entries ( obj ) ) {
6060 if ( value . includes ( "FAIL" ) && value . includes ( "_test.go" ) ) {
61- const result = regex . exec ( value ) ;
62- if ( result ! = null ) {
61+ var result ;
62+ while ( ( result = regex . exec ( value ) ) != = null ) {
6363 const parts = result [ 0 ] . split ( ":" ) ;
64- const file = key . split ( "/" ) . slice ( 0 , - 1 ) . join ( "/" ) + "/" + parts [ 0 ] ;
64+ const file = key . split ( "/" ) . slice ( 0 , - 1 ) . join ( "/" ) + "/" + parts [ 0 ] . trimStart ( ) ;
6565 const lineNumber = parts [ 1 ] ;
66- core . info ( `::error file=${ file } ,line=${ lineNumber } ::${ value } ` ) ;
66+ core . info ( `::error file=${ file } ,line=${ lineNumber } ::${ result [ 0 ] } ` ) ;
6767 }
6868 }
6969 }
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ const lineReader = require('line-by-line');
33const fs = require ( 'fs' ) ;
44
55try {
6- const regex = / [ \w \d ] + _ t e s t .g o : \d + : / iu ; // Extracts file name and line where test failures occurred
6+ const regex = / ( \s * [ \w \d ] + _ t e s t .g o : \d + : ) ( . * ? ) ( T e s t : \s + T e s t [ \w \d ] * ? % 0 A ) / gu ; // Extracts only the failure from the logs (including whitespace)
77
88 const testResultsPath = core . getInput ( 'test-results' ) ;
99 const customPackageName = core . getInput ( 'package-name' ) ;
@@ -51,12 +51,12 @@ try {
5151 lr . on ( 'end' , function ( ) {
5252 for ( const [ key , value ] of Object . entries ( obj ) ) {
5353 if ( value . includes ( "FAIL" ) && value . includes ( "_test.go" ) ) {
54- const result = regex . exec ( value ) ;
55- if ( result ! = null ) {
54+ var result ;
55+ while ( ( result = regex . exec ( value ) ) != = null ) {
5656 const parts = result [ 0 ] . split ( ":" ) ;
57- const file = key . split ( "/" ) . slice ( 0 , - 1 ) . join ( "/" ) + "/" + parts [ 0 ] ;
57+ const file = key . split ( "/" ) . slice ( 0 , - 1 ) . join ( "/" ) + "/" + parts [ 0 ] . trimStart ( ) ;
5858 const lineNumber = parts [ 1 ] ;
59- core . info ( `::error file=${ file } ,line=${ lineNumber } ::${ value } ` ) ;
59+ core . info ( `::error file=${ file } ,line=${ lineNumber } ::${ result [ 0 ] } ` ) ;
6060 }
6161 }
6262 }
You can’t perform that action at this time.
0 commit comments