File tree Expand file tree Collapse file tree 1 file changed +22
-4
lines changed
Expand file tree Collapse file tree 1 file changed +22
-4
lines changed Original file line number Diff line number Diff line change @@ -12,12 +12,30 @@ export const testExitCodeInterceptor = {
1212
1313 afterTrigger : async function bail ( hookContext : HookTriggerContext < [ models . ProcessorContext ] , boolean > ) {
1414 const context = hookContext . args [ 0 ] ;
15- const hasFailedOrErroredTestResult = context . httpRegion . testResults ?. some ?.(
16- obj => obj . status === models . TestResultStatus . FAILED || obj . status === models . TestResultStatus . ERROR
17- ) ;
18- if ( hasFailedOrErroredTestResult ) {
15+
16+ if ( context . httpRegion . testResults === undefined ) {
17+ return true ;
18+ }
19+
20+ let hasErroredTestResult = false ;
21+ let hasFailedTestResult = false ;
22+
23+ for ( const testResult of context . httpRegion . testResults ) {
24+ if ( testResult . status === models . TestResultStatus . ERROR ) {
25+ hasErroredTestResult = true ;
26+ break ;
27+ }
28+ if ( testResult . status === models . TestResultStatus . FAILED ) {
29+ hasFailedTestResult = true ;
30+ }
31+ }
32+
33+ if ( hasErroredTestResult ) {
34+ process . exitCode = 19 ;
35+ } else if ( hasFailedTestResult ) {
1936 process . exitCode = 20 ;
2037 }
38+
2139 return true ;
2240 } ,
2341} ;
You can’t perform that action at this time.
0 commit comments