File tree Expand file tree Collapse file tree 2 files changed +18
-8
lines changed Expand file tree Collapse file tree 2 files changed +18
-8
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,8 @@ const lineReader = __webpack_require__(631);
10
10
const fs = __webpack_require__ ( 747 ) ;
11
11
12
12
try {
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)
14
+
13
15
const testResultsPath = core . getInput ( 'test-results' ) ;
14
16
const customPackageName = core . getInput ( 'package-name' ) ;
15
17
@@ -56,10 +58,13 @@ try {
56
58
lr . on ( 'end' , function ( ) {
57
59
for ( const [ key , value ] of Object . entries ( obj ) ) {
58
60
if ( value . includes ( "FAIL" ) && value . includes ( "_test.go" ) ) {
59
- const parts = value . split ( "%0A" ) [ 1 ] . trim ( ) . split ( ":" ) ;
60
- const file = key . split ( "/" ) . slice ( 0 , - 1 ) . join ( "/" ) + "/" + parts [ 0 ] ;
61
- const lineNumber = parts [ 1 ] ;
62
- core . info ( `::error file=${ file } ,line=${ lineNumber } ::${ value } ` )
61
+ var result ;
62
+ while ( ( result = regex . exec ( value ) ) !== null ) {
63
+ const parts = result [ 0 ] . split ( ":" ) ;
64
+ const file = key . split ( "/" ) . slice ( 0 , - 1 ) . join ( "/" ) + "/" + parts [ 0 ] . trimStart ( ) ;
65
+ const lineNumber = parts [ 1 ] ;
66
+ core . info ( `::error file=${ file } ,line=${ lineNumber } ::${ result [ 0 ] } ` ) ;
67
+ }
63
68
}
64
69
}
65
70
} ) ;
Original file line number Diff line number Diff line change @@ -3,6 +3,8 @@ const lineReader = require('line-by-line');
3
3
const fs = require ( 'fs' ) ;
4
4
5
5
try {
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)
7
+
6
8
const testResultsPath = core . getInput ( 'test-results' ) ;
7
9
const customPackageName = core . getInput ( 'package-name' ) ;
8
10
@@ -49,10 +51,13 @@ try {
49
51
lr . on ( 'end' , function ( ) {
50
52
for ( const [ key , value ] of Object . entries ( obj ) ) {
51
53
if ( value . includes ( "FAIL" ) && value . includes ( "_test.go" ) ) {
52
- const parts = value . split ( "%0A" ) [ 1 ] . trim ( ) . split ( ":" ) ;
53
- const file = key . split ( "/" ) . slice ( 0 , - 1 ) . join ( "/" ) + "/" + parts [ 0 ] ;
54
- const lineNumber = parts [ 1 ] ;
55
- core . info ( `::error file=${ file } ,line=${ lineNumber } ::${ value } ` )
54
+ var result ;
55
+ while ( ( result = regex . exec ( value ) ) !== null ) {
56
+ const parts = result [ 0 ] . split ( ":" ) ;
57
+ const file = key . split ( "/" ) . slice ( 0 , - 1 ) . join ( "/" ) + "/" + parts [ 0 ] . trimStart ( ) ;
58
+ const lineNumber = parts [ 1 ] ;
59
+ core . info ( `::error file=${ file } ,line=${ lineNumber } ::${ result [ 0 ] } ` ) ;
60
+ }
56
61
}
57
62
}
58
63
} ) ;
You can’t perform that action at this time.
0 commit comments