Skip to content

Commit

Permalink
Fix issue 115 "Cannot read property 'type' of undefined" (#116)
Browse files Browse the repository at this point in the history
  • Loading branch information
JuanMaRuiz authored Sep 8, 2020
1 parent f59a309 commit 898d7c7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
2 changes: 1 addition & 1 deletion lib/output.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ const opportunities = (lighthouseResult, links) => {

const opportunityRules = rules.filter(rule => {
const {details} = audits[rule.id];
return details.type === 'opportunity' && details.overallSavingsMs > 0;
return Boolean(details) && details.type === 'opportunity' && details.overallSavingsMs > 0;
});

const ret = opportunityRules.map(rule => {
Expand Down
8 changes: 1 addition & 7 deletions test/fixtures/response.json
Original file line number Diff line number Diff line change
Expand Up @@ -599,13 +599,7 @@
"description": "Consider adding preconnect or dns-prefetch resource hints to establish early connections to important third-party origins. [Learn more](https://developers.google.com/web/fundamentals/performance/resource-prioritization#preconnect).",
"score": 1.0,
"scoreDisplayMode": "numeric",
"warnings": [],
"details": {
"type": "opportunity",
"items": [],
"overallSavingsMs": 0.0,
"headings": []
}
"warnings": []
},
"bootup-time": {
"id": "bootup-time",
Expand Down

0 comments on commit 898d7c7

Please sign in to comment.