From 2404dc7c61eb32f6853463587f653a031ee66a3f Mon Sep 17 00:00:00 2001 From: Kristiyan Kostadinov Date: Tue, 7 Oct 2025 06:01:27 -0400 Subject: [PATCH 1/2] fix: only store relevant properties of lighthouse audit Currently we store the entire Lighthouse audit object in the report which increases the report size and can make the report hard to serialize. These changes only capture the properties we care about. --- runner/workers/serve-testing/lighthouse.ts | 14 +++++++++++++- runner/workers/serve-testing/worker-types.ts | 12 +++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/runner/workers/serve-testing/lighthouse.ts b/runner/workers/serve-testing/lighthouse.ts index be9a8cb..fabcb8a 100644 --- a/runner/workers/serve-testing/lighthouse.ts +++ b/runner/workers/serve-testing/lighthouse.ts @@ -38,7 +38,19 @@ export async function getLighthouseData( const isAllowedDisplayMode = displayMode === 'binary' || displayMode === 'numeric'; if (audit.score != null && isAllowedType && isAllowedDisplayMode) { - availableAudits.set(audit.id, audit); + availableAudits.set(audit.id, { + // Only capture the properties we care about in order to keep + // the report size small and avoid serialization errors. + id: audit.id, + score: audit.score, + title: audit.title, + displayValue: audit.displayValue ?? null, + description: audit.description, + explanation: audit.explanation ?? null, + scoreDisplayMode: displayMode, + numericValue: audit.numericValue ?? null, + numericUnit: audit.numericUnit ?? null, + }); } } diff --git a/runner/workers/serve-testing/worker-types.ts b/runner/workers/serve-testing/worker-types.ts index b030c0b..6adb5ce 100644 --- a/runner/workers/serve-testing/worker-types.ts +++ b/runner/workers/serve-testing/worker-types.ts @@ -66,7 +66,17 @@ export type ServeTestingWorkerResponseMessage = | ServeTestingProgressLogMessage | ServeTestingResultMessage; -export type LighthouseAudit = LighthouseRunnerResult['lhr']['audits']['x']; // Lighthouse doesn't export this so we need to dig for it. +export interface LighthouseAudit { + id: string; + score: number | null; + title: string; + displayValue: string | null; + description: string | null; + explanation: string | null; + scoreDisplayMode: 'numeric' | 'binary'; + numericValue: number | null; + numericUnit: string | null; +} export interface LighthouseCategory { id: string; From baed5037588143544da7503861c85fc8c60da23c Mon Sep 17 00:00:00 2001 From: Kristiyan Kostadinov Date: Tue, 7 Oct 2025 06:10:14 -0400 Subject: [PATCH 2/2] fix: propery display binary Lighthouse results Fixes that we were displaying binary Lighthouse results as numbers. --- .../src/app/pages/report-viewer/lighthouse-category.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/report-app/src/app/pages/report-viewer/lighthouse-category.ts b/report-app/src/app/pages/report-viewer/lighthouse-category.ts index 6e0791a..ebe826c 100644 --- a/report-app/src/app/pages/report-viewer/lighthouse-category.ts +++ b/report-app/src/app/pages/report-viewer/lighthouse-category.ts @@ -24,7 +24,14 @@ import {Score} from '../../shared/score/score'; @for (audit of audits; track audit.id) {
  • @if (audit.score != null) { - + @if (audit.scoreDisplayMode === 'binary') { + @let isPass = audit.score === 1; + + {{isPass ? 'check' : 'close'}} + + } @else { + + } } {{audit.title}}{{audit.displayValue ? ': ' + audit.displayValue : ''}}