Skip to content

Commit

Permalink
Reduce event duplication
Browse files Browse the repository at this point in the history
  • Loading branch information
BlueWinds committed Feb 8, 2022
1 parent 9d433c7 commit 3cf4a2b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion system-tests/lib/performance-reporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,11 @@ class HoneycombReporter {
console.log(chalk.green('Reporting to honeycomb'))

runner.on('suite', (suite) => {
const parent = suite.root ? circleCiRootEvent : suite.parent.honeycombEvent
if (!suite.title) {
return
}

const parent = suite.parent && suite.parent.honeycombEvent ? suite.parent.honeycombEvent : circleCiRootEvent

suite.honeycombEvent = honey.newEvent()
suite.honeycombEvent.timestamp = Date.now()
Expand Down Expand Up @@ -99,6 +103,10 @@ class HoneycombReporter {
})

runner.on('suite end', (suite) => {
if (!suite.honeycombEvent) {
return
}

suite.honeycombEvent.add({
durationMs: Date.now() - suite.honeycombEvent.timestamp,
})
Expand Down

0 comments on commit 3cf4a2b

Please sign in to comment.