@@ -63,6 +63,7 @@ class TestExecutable {
6363 let _apiCalls = [ ] ;
6464 let _actionReports = [ ] ;
6565 let timeoutId ;
66+ let currentActionIndex = 0 ;
6667
6768 // TIMING
6869 const { performance } = require ( "perf_hooks" ) ;
@@ -90,7 +91,7 @@ class TestExecutable {
9091 let result = { contextWrites : [ ] , apiCalls : [ ] , actionReports : [ ] } ;
9192 //2. evaluate action
9293 try {
93- result = Object . assign ( result , await action . eval ( context , stepTimeoutSeconds ) ) ;
94+ result = Object . assign ( result , await action . eval ( context , timeoutSeconds , stepTimeoutSeconds ) ) ;
9495 } catch ( e ) {
9596 result . actionReports = [
9697 {
@@ -116,24 +117,40 @@ class TestExecutable {
116117 // this does need to bubble to the top for child tests to be correctly scoped
117118 // into a parent.
118119 totalContextWrites . push ( ...result . contextWrites ) ;
120+ currentActionIndex += 1 ;
119121 }
120122 // Clear the timeout or else the lambda will hang around until it finishes which is not
121123 // ideal for default workers without a frequency value.
122124 clearTimeout ( timeoutId ) ;
123125 return FINISHED_EXECUTION ;
124126 } ) ( ) ;
125127 let result = await Promise . race ( [ timeoutTimer , testExecution ] ) ;
126- //TIMING
128+ // TIMING
127129 const t1 = performance . now ( ) ;
128130 const elapsedTime = t1 - t0 ;
129131
130- //OVERALL SUCCESS
132+ // OVERALL SUCCESS
131133 let success = _actionReports . filter ( ( a ) => a . success == false ) . length == 0 && result === FINISHED_EXECUTION ;
134+ let _finalReport = _actionReports ;
135+
136+ if ( result === TIMEOUT ) {
137+ const finishedStepsTotalTime = _finalReport . reduce ( ( a , c ) => a + c . time , 0 ) ;
138+
139+ // Add a failed step for the test timeout limit and inform the user that subsequent steps
140+ // have been skipped
141+ _finalReport . push ( {
142+ action : actions [ currentActionIndex ] . action ,
143+ success : false ,
144+ shortSummary : `Test exceeded timeout limit of ${ timeoutSeconds } s. Subsequent steps skipped.` ,
145+ longSummary : null ,
146+ time : elapsedTime - finishedStepsTotalTime , // time delta is where the step terminated due to timeout
147+ } ) ;
148+ }
132149
133150 return {
134151 contextWrites : totalContextWrites , // optional
135152 apiCalls : _apiCalls ,
136- actionReports : _actionReports ,
153+ actionReports : _finalReport ,
137154 elapsedTime,
138155 success,
139156 timedOut : result === TIMEOUT ,
0 commit comments