fix: use compare with --cpu for Firefox failed. (#4324)

This catches if we got no longtask information.
This commit is contained in:
Peter Hedenskog 2024-11-23 19:51:26 +01:00 committed by GitHub
parent d3a27f42e5
commit 957fe5220b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 12 additions and 10 deletions

View File

@ -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);