Skip to content

Commit

Permalink
fix: use compare with --cpu for Firefox failed. (#4324)
Browse files Browse the repository at this point in the history
This catches if we got no longtask information.
  • Loading branch information
soulgalore authored Nov 23, 2024
1 parent d3a27f4 commit 957fe52
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions lib/plugins/compare/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -275,16 +275,18 @@ function getCPU(data) {
};

for (const run of data.cpu) {
const longTasks = run.longTasks;
cpuMetrics['tasks'].push(longTasks['tasks']);
cpuMetrics['totalDuration'].push(longTasks['totalDuration']);
cpuMetrics['lastLongTask'].push(longTasks['lastLongTask']);
cpuMetrics['beforeFirstContentfulPaint'].push(
longTasks['beforeFirstContentfulPaint'].totalDuration
);
cpuMetrics['beforeLargestContentfulPaint'].push(
longTasks['beforeLargestContentfulPaint'].totalDuration
);
if (run.longTasks) {
const longTasks = run.longTasks;
cpuMetrics['tasks'].push(longTasks['tasks']);
cpuMetrics['totalDuration'].push(longTasks['totalDuration']);
cpuMetrics['lastLongTask'].push(longTasks['lastLongTask']);
cpuMetrics['beforeFirstContentfulPaint'].push(
longTasks['beforeFirstContentfulPaint'].totalDuration
);
cpuMetrics['beforeLargestContentfulPaint'].push(
longTasks['beforeLargestContentfulPaint'].totalDuration
);
}
}

const isEmpty = Object.values(cpuMetrics).every(arr => arr.length === 0);
Expand Down

0 comments on commit 957fe52

Please sign in to comment.