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 : ''}} 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;