diff --git a/packages/cli/src/assert/assert.js b/packages/cli/src/assert/assert.js index 978e391d7..748147c99 100644 --- a/packages/cli/src/assert/assert.js +++ b/packages/cli/src/assert/assert.js @@ -72,12 +72,23 @@ async function runCommand(options) { for (const result of sortedResults) { hasFailure = hasFailure || result.level === 'error'; const label = result.level === 'warn' ? 'warning' : 'failure'; - const warningOrErrorIcon = result.level === 'warn' ? '⚠️ ' : `${log.redify(log.cross)} `; + const icon = result.level === 'warn' ? '⚠️ ' : `${log.redify(log.cross)} `; const idPart = `${log.bold}${result.auditId}${log.reset}`; const propertyPart = result.auditProperty ? `.${result.auditProperty}` : ''; const namePart = `${log.bold}${result.name}${log.reset}`; + + const auditTitlePart = result.auditTitle || ''; + const documentationPart = result.auditDocumentationLink + ? `Documentation: ${result.auditDocumentationLink}` + : ''; + const titleAndDocs = [auditTitlePart, documentationPart] + .filter(Boolean) + .map(s => ` ` + s) + .join('\n'); + const humanFriendlyParts = titleAndDocs ? `\n${titleAndDocs}\n` : ''; + process.stderr.write(` - ${warningOrErrorIcon} ${idPart}${propertyPart} ${label} for ${namePart} assertion + ${icon} ${idPart}${propertyPart} ${label} for ${namePart} assertion${humanFriendlyParts} expected: ${result.operator}${log.greenify(result.expected)} found: ${log.redify(result.actual)} ${log.dim}all values: ${result.values.join(', ')}${log.reset}\n\n`); diff --git a/packages/cli/test/autorun.test.js b/packages/cli/test/autorun.test.js index de8b3081d..6e2aa4238 100644 --- a/packages/cli/test/autorun.test.js +++ b/packages/cli/test/autorun.test.js @@ -56,6 +56,9 @@ describe('Lighthouse CI autorun CLI', () => { 1 result(s) for http://localhost:XXXX/good.html ✘ viewport failure for minScore assertion + Does not have a \`\` tag with \`width\` or \`initial-scale\` + Documentation: https://web.dev/viewport + expected: >=1 found: 0 all values: 0, 0, 0 diff --git a/packages/cli/test/cli.test.js b/packages/cli/test/cli.test.js index f98f143a5..ae45fec19 100644 --- a/packages/cli/test/cli.test.js +++ b/packages/cli/test/cli.test.js @@ -234,6 +234,9 @@ describe('Lighthouse CI CLI', () => { 1 result(s) for http://localhost:XXXX/app/ ✘ works-offline failure for minScore assertion + Current page does not respond with a 200 when offline + Documentation: https://web.dev/works-offline + expected: >=1 found: 0 all values: 0, 0 @@ -265,6 +268,9 @@ describe('Lighthouse CI CLI', () => { 1 result(s) for http://localhost:XXXX/app/ ✘ performance-budget.script.size failure for maxNumericValue assertion + Performance budget + Documentation: https://developers.google.com/web/tools/lighthouse/audits/budgets + expected: <=XXXX found: XXXX all values: XXXX @@ -295,12 +301,18 @@ describe('Lighthouse CI CLI', () => { 2 result(s) for http://localhost:XXXX/app/ ✘ first-contentful-paint failure for maxNumericValue assertion + First Contentful Paint + Documentation: https://web.dev/first-contentful-paint + expected: <=1 found: XXXX all values: XXXX, XXXX ✘ performance-budget.script.size failure for maxNumericValue assertion + Performance budget + Documentation: https://developers.google.com/web/tools/lighthouse/audits/budgets + expected: <=XXXX found: XXXX all values: XXXX @@ -329,6 +341,9 @@ describe('Lighthouse CI CLI', () => { 1 result(s) for http://localhost:XXXX/app/ ✘ resource-summary.script.size failure for maxNumericValue assertion + Keep request counts low and transfer sizes small + Documentation: https://developers.google.com/web/tools/lighthouse/audits/budgets + expected: <=1 found: XXXX all values: XXXX, XXXX