Skip to content

Commit f01330a

Browse files
committed
fix hooks ordering
1 parent 0957633 commit f01330a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

bin/testObservability/reporter/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ class MyReporter {
303303
'result': eventType === "TestRunSkipped" ? 'skipped' : ( eventType === "TestRunStarted" ? 'pending' : this.analyticsResult(test, eventType, err) ),
304304
'failure_reason': failureReason,
305305
'duration_in_ms': test.duration || (eventType.match(/Finished/) || eventType.match(/Skipped/) ? Date.now() - (new Date(test.started_at)).getTime() : null),
306-
'started_at': ( eventType.match(/Started/) ? (new Date()).toISOString() : ( ( (eventType.match(/TestRun/) ? test.test_started_at : test.hook_started_at) || test.started_at ) || (new Date()).toISOString() ) ),
306+
'started_at': ( ( (eventType.match(/TestRun/) ? test.test_started_at : test.hook_started_at) || test.started_at ) || (new Date()).toISOString() ),
307307
'finished_at': eventType.match(/Finished/) || eventType.match(/Skipped/) ? (new Date()).toISOString() : null,
308308
'failure': failureData(...failureArgs),
309309
'failure_type': !failureReason ? null : failureReason.match(/AssertionError/) ? 'AssertionError' : 'UnhandledError',
@@ -386,6 +386,8 @@ class MyReporter {
386386
event_type: eventType === "TestRunSkipped" ? "TestRunFinished" : eventType,
387387
}
388388

389+
if(eventType.match(/Finished/)) delete testData.started_at;
390+
389391
if(eventType.match(/HookRun/)) {
390392
testData['hook_type'] = HOOK_TYPES_MAP[testData['hook_type']];
391393
uploadData['hook_run'] = testData;

0 commit comments

Comments
 (0)