Skip to content

Commit

Permalink
feat(plugin-lighthouse): keep audit values as floats
Browse files Browse the repository at this point in the history
  • Loading branch information
matejchalk committed Jun 27, 2024
1 parent e9b8fd1 commit 2627a87
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/plugin-lighthouse/src/lib/runner/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export function toAuditOutputs(
const auditOutput: AuditOutput = {
slug,
score: score ?? 1, // score can be null
value: Number.parseInt(value.toString(), 10),
value,
displayValue,
};

Expand Down
4 changes: 2 additions & 2 deletions packages/plugin-lighthouse/src/lib/runner/utils.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ describe('toAuditOutputs', () => {
).not.toThrow();
});

it('should parse valid lhr float value to integer', () => {
it('should copy lhr numericValue to audit value as float', () => {
expect(
toAuditOutputs([
{
Expand All @@ -106,7 +106,7 @@ describe('toAuditOutputs', () => {
displayValue: '2.8 s',
},
]),
).toStrictEqual([expect.objectContaining({ value: 2838 })]);
).toStrictEqual([expect.objectContaining({ value: 2838.974 })]);
});

it('should convert null score to 1', () => {
Expand Down

0 comments on commit 2627a87

Please sign in to comment.