@@ -63,6 +63,7 @@ class TestExecutable {
63
63
let _apiCalls = [ ] ;
64
64
let _actionReports = [ ] ;
65
65
let timeoutId ;
66
+ let currentActionIndex = 0 ;
66
67
67
68
// TIMING
68
69
const { performance } = require ( "perf_hooks" ) ;
@@ -90,7 +91,7 @@ class TestExecutable {
90
91
let result = { contextWrites : [ ] , apiCalls : [ ] , actionReports : [ ] } ;
91
92
//2. evaluate action
92
93
try {
93
- result = Object . assign ( result , await action . eval ( context , stepTimeoutSeconds ) ) ;
94
+ result = Object . assign ( result , await action . eval ( context , timeoutSeconds , stepTimeoutSeconds ) ) ;
94
95
} catch ( e ) {
95
96
result . actionReports = [
96
97
{
@@ -116,24 +117,40 @@ class TestExecutable {
116
117
// this does need to bubble to the top for child tests to be correctly scoped
117
118
// into a parent.
118
119
totalContextWrites . push ( ...result . contextWrites ) ;
120
+ currentActionIndex += 1 ;
119
121
}
120
122
// Clear the timeout or else the lambda will hang around until it finishes which is not
121
123
// ideal for default workers without a frequency value.
122
124
clearTimeout ( timeoutId ) ;
123
125
return FINISHED_EXECUTION ;
124
126
} ) ( ) ;
125
127
let result = await Promise . race ( [ timeoutTimer , testExecution ] ) ;
126
- //TIMING
128
+ // TIMING
127
129
const t1 = performance . now ( ) ;
128
130
const elapsedTime = t1 - t0 ;
129
131
130
- //OVERALL SUCCESS
132
+ // OVERALL SUCCESS
131
133
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
+ }
132
149
133
150
return {
134
151
contextWrites : totalContextWrites , // optional
135
152
apiCalls : _apiCalls ,
136
- actionReports : _actionReports ,
153
+ actionReports : _finalReport ,
137
154
elapsedTime,
138
155
success,
139
156
timedOut : result === TIMEOUT ,
0 commit comments