Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,14 @@ import {Score} from '../../shared/score/score';
@for (audit of audits; track audit.id) {
<li>
@if (audit.score != null) {
<score size="tiny" [total]="audit.score" [max]="1"/>
@if (audit.scoreDisplayMode === 'binary') {
@let isPass = audit.score === 1;
<span class="status-text material-symbols-outlined {{isPass ? 'success' : 'error'}}">
{{isPass ? 'check' : 'close'}}
</span>
} @else {
<score size="tiny" [total]="audit.score" [max]="1"/>
}
}
{{audit.title}}{{audit.displayValue ? ': ' + audit.displayValue : ''}}

Expand Down
14 changes: 13 additions & 1 deletion runner/workers/serve-testing/lighthouse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
}
}

Expand Down
12 changes: 11 additions & 1 deletion runner/workers/serve-testing/worker-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading