Skip to content

Commit ab2fe54

Browse files
committed
feat(plugin-lighthouse): prettify table validation errors
1 parent c78c726 commit ab2fe54

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

packages/plugin-lighthouse/src/lib/runner/details/opportunity.type.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import {
33
type Table,
44
type TableRowObject,
55
tableSchema,
6+
validate,
67
} from '@code-pushup/models';
78
import { formatBytes, formatDuration, html } from '@code-pushup/utils';
89
import { parseTableColumns, parseTableEntry } from './table.type.js';
@@ -18,7 +19,7 @@ export function parseOpportunityToAuditDetailsTable(
1819
}
1920

2021
try {
21-
return tableSchema().parse({
22+
return validate(tableSchema(), {
2223
title: 'Opportunity',
2324
columns: parseTableColumns(headings),
2425
rows: items.map(row => parseOpportunityItemToTableRow(row, headings)),

packages/plugin-lighthouse/src/lib/runner/details/table.type.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {
44
type TableColumnObject,
55
type TableRowObject,
66
tableSchema,
7+
validate,
78
} from '@code-pushup/models';
89
import { formatTableItemPropertyValue } from './item-value.js';
910
import { LighthouseAuditDetailsParsingError } from './utils.js';
@@ -18,7 +19,7 @@ export function parseTableToAuditDetailsTable(
1819
}
1920

2021
try {
21-
return tableSchema().parse({
22+
return validate(tableSchema(), {
2223
columns: parseTableColumns(headings),
2324
rows: items.map(row => parseTableRow(row, headings)),
2425
});

0 commit comments

Comments
 (0)