diff --git a/src/localLighthouse.js b/src/localLighthouse.js index 5af6cd8..f339589 100644 --- a/src/localLighthouse.js +++ b/src/localLighthouse.js @@ -122,6 +122,7 @@ export const localLighthouse = async ({ localReport, report, emulatedFormFactor, + runtimeError: get(result, 'runtimeError.message'), scores }; }; diff --git a/src/logResults.js b/src/logResults.js index ca7bd5b..4631892 100644 --- a/src/logResults.js +++ b/src/logResults.js @@ -44,7 +44,11 @@ export default ({ isGitHubAction, isLocalAudit, isOrb, results }) => { Object.values(result.scores) ]; console.log('\n'); - console.log(table(tableData, tableConfig)); + if (result.runtimeError) { + console.log(`Lighthouse runtime error: ${result.runtimeError}`); + } else { + console.log(table(tableData, tableConfig)); + } console.log('\n'); }); diff --git a/src/postPrComment.js b/src/postPrComment.js index 6f43e90..a2561cf 100644 --- a/src/postPrComment.js +++ b/src/postPrComment.js @@ -5,7 +5,7 @@ import LighthouseCheckError from './LighthouseCheckError'; import { ERROR_UNEXPECTED_RESPONSE } from './errorCodes'; import { NAME } from './constants'; -const getBadge = ({ title, score }) => +const getBadge = ({ title, score = 0 }) => `![](https://img.shields.io/badge/${title}-${score}-${getLighthouseScoreColor( { isHex: false, @@ -43,6 +43,11 @@ export default async ({ }); }); + // error + if (result.runtimeError) { + markdown += `**Lighthouse runtime error**: ${result.runtimeError}\n\n`; + } + // table header markdown += `\n| Device ${!result.report ? '' : `| Report `}| URL |\n`; markdown += `|--${!result.report ? '' : `|--`}|--|\n`; diff --git a/src/slackNotify.js b/src/slackNotify.js index 637db32..a3f851b 100644 --- a/src/slackNotify.js +++ b/src/slackNotify.js @@ -54,6 +54,11 @@ export default async ({ footer }) }, + ...(result.runtimeError && { + color: '#f74531', + text: `*Lighthouse runtime error*: ${result.runtimeError}`, + short: true + }), ...Object.keys(result.scores).map(current => ({ color: getLighthouseScoreColor({ isHex: true,