Skip to content

Commit

Permalink
fix(plugin-coverage): always include issues array, even if empty
Browse files Browse the repository at this point in the history
  • Loading branch information
matejchalk committed May 23, 2024
1 parent a047ba9 commit bd7c563
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ exports[`lcovResultsToAuditOutputs > should correctly convert lcov results to Au
"value": 80,
},
{
"details": {
"issues": [],
},
"displayValue": "100 %",
"score": 1,
"slug": "function-coverage",
Expand Down
4 changes: 3 additions & 1 deletion packages/plugin-coverage/src/lib/runner/lcov/transform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ export function lcovCoverageToAuditOutput(
score: toNumberPrecision(coverage, MAX_DECIMAL_PLACES),
value: roundedIntValue,
displayValue: `${roundedIntValue} %`,
...(stat.issues.length > 0 && { details: { issues: stat.issues } }),
details: {
issues: stat.issues,
},
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,7 @@ describe('lcovCoverageToAudit', () => {
score: 1,
value: 100,
displayValue: '100 %',
details: { issues: [] },
});
});

Expand All @@ -318,6 +319,7 @@ describe('lcovCoverageToAudit', () => {
score: 1,
value: 100,
displayValue: '100 %',
details: { issues: [] },
});
});

Expand Down

0 comments on commit bd7c563

Please sign in to comment.