Skip to content

Latest commit

 

History

History
248 lines (215 loc) · 9.79 KB

understanding-results.md

File metadata and controls

248 lines (215 loc) · 9.79 KB

Understanding the Results

The results object contains all the audit information Lighthouse determined about the page. In fact, everything you see in the HTML report, even the screenshots, is a rendering of information contained in the results object. You might need to work directly with the results object if you use Lighthouse programmatically, consume the JSON output of the CLI, explore Lighthouse results in HTTPArchive, or work on the report generation code that reads the Lighthouse JSON and outputs HTML.

Lighthouse Results Object (LHR)

The top-level Lighthouse Results object (LHR) is what the lighthouse node module returns and the entirety of the JSON output of the CLI. It contains some metadata about the run and the results in the various subproperties below.

Properties

Name Description
lighthouseVersion The version of Lighthouse with which these results were generated.
fetchedAt The ISO-8601 timestamp of when the results were generated.
userAgent The user agent string of the version of Chrome that was used by Lighthouse.
initialUrl The URL that was supplied to Lighthouse and initially navigated to.
url The URL that Lighthouse ended up auditing after redirects were followed.
audits An object containing the results of the audits.
runtimeConfig An object containing information about the configuration used by Lighthouse.
timing An object containing information about how long Lighthouse spent auditing.
reportCategories An array containing the different categories, their scores, and the results of the audits that comprise them.
reportGroups An object containing the display groups of audits for the report.
artifacts (PROGRAMMATIC USE ONLY) An object containing gatherer results.

Example

{
  "lighthouseVersion": "2.4.0",
  "fetchedAt": "2017-10-05T20:50:54.185Z",
  "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3233.0 Safari/537.36",
  "initialUrl": "http://example.com",
  "url": "https://www.example.com/",
  "score": 50,
  "audits": {...},
  "runtimeConfig": {...},
  "timing": {...},
  "reportCategories": [{...}],
  "reportGroups": {...},
}

audits

An object containing the results of the audits, keyed by their name.

Audit Properties

Name Type Description
name string The string identifier of the audit in kebab case.
description string The brief description of the audit. The text can change depending on if the audit passed or failed. It may contain markdown code.
helpText string A more detailed description that describes why the audit is important and links to Lighthouse documentation on the audit, markdown links supported.
debugString string|undefined A string indicating some additional information to the user explaining an unusual circumstance or reason for failure.
error boolean Set to true if there was an an exception thrown within the audit. The error message will be in debugString.
rawValue boolean|number The unscored value determined by the audit. Typically this will match the score if there's no additional information to impart. For performance audits, this value is typically a number indicating the metric value.
displayValue string The string to display in the report alongside audit results. If empty, nothing additional is shown. This is typically used to explain additional information such as the number and nature of failing items.
score number The scored value determined by the audit as a number 0-1, representing displayed scores of 0-100.
scoreDisplayMode "binary"|"numeric" A string identifying how the score should be interpreted i.e. is the audit pass/fail (score of 1 or 0), or are there shades of gray (scores between 0-1 inclusive).
details Object Extra information found by the audit necessary for display. The structure of this object varies from audit to audit. The structure of this object is somewhat stable between minor version bumps as this object is used to render the HTML report.
extendedInfo Object Extra information found by the audit. The structure of this object varies from audit to audit and is generally for programmatic consumption and debugging, though there is typically overlap with details. WARNING: The structure of this object is not stable and cannot be trusted to follow semver
manual boolean Indicator used for display that the audit does not have results and is a placeholder for the user to conduct manual testing.
informative boolean Indicator used for display that the audit is intended to be informative only. It cannot be passed or failed.
notApplicable boolean Indicator used for display that the audit doesn't apply to the page. (e.g. A images audit on a page without images).

Example

{
  "is-on-https": {
    "name": "is-on-https",
    "category": "Security",
    "description": "Uses HTTPS",
    "failureDescription": "Does not use HTTPS",
    "helpText": "HTTPS is the best. [Learn more](https://learn-more)",
    "score": 0,
    "rawValue": false,
    "displayValue": "2 insecure requests found",
    "scoreDisplayMode": "binary",
    "details": {
      "type": "list",
      "header": {
        "type": "text",
        "text": "Insecure URLs:"
      },
      "items": [
        {
          "type": "url",
          "text": "http://example.com/"
        },
        {
          "type": "url",
          "text": "http://example.com/favicon.ico"
        }
      ]
    },
    "extendedInfo": {
      "value": [
        {
          "url": "http://example.com/"
        },
        {
          "url": "http://example.com/favicon.ico"
        }
      ]
    },
  },
  "custom-audit": {
    "name": "custom-audit",
    ...
  }
}

runtimeConfig

An object containing information about the configuration used by Lighthouse.

Properties

Name Type Description
blockedUrlPatterns string[] The network request patterns that Lighthouse blocked while loading the page.
environment Object[] The environment settings used such as CPU and network throttling and device emulation.

Example

{
  "blockedUrlPatterns": ["bad-script.js"],
  "environment": [
    {
      "name": "Device Emulation",
      "enabled": true,
      "description": "Nexus 5X"
    },
    {
      "name": "Network Throttling",
      "enabled": true,
      "description": "562.5ms RTT, 1.4Mbps down, 0.7Mbps up"
    },
    {
      "name": "CPU Throttling",
      "enabled": true,
      "description": "4x slowdown"
    }
  ]
}

timing

An object containing information about how long Lighthouse spent auditing.

Properties

Name Type Description
total number The total time spent in milliseconds loading the page and evaluating audits.

Example

{
  "total": 32189
}

reportCategories

An array containing the different categories, their scores, and the results of the audits in the categories.

CategoryEntry Properties

Name Type Description
id string The string identifier of the category.
name string The human-friendly name of the category.
description string A brief description of the purpose of the category, supports markdown links.
score string The overall score of the category, the weighted average of all its audits.
weight string The weight of the category in the overall Lighthouse score.
audits AuditEntry[] An array of all the audit results in the category.

AuditEntry Properties

Name Type Description
id string The string identifier of the category.
weight number The weight of the audit's score in the overall category score.
result Object The actual audit result, a copy of the audit object found in audits. NOTE: this property will likely be removed in upcoming releases; use the id property to lookup the result in the audits property.

Example

[
  {
    "id": "pwa",
    "name": "Progressive Web App",
    "description": "PWAs are awesome. [Learn more](...)",
    "score": 54,
    "weight": 1,
    "audits": [
      {
        "id": "is-on-https",
        "score": 0,
        "weight": 1,
        "result": {
          "name": "is-on-https",
          "score": 0,
          ...
        }
      }
    ]
  }
]

reportGroups

An object containing the display groups of audits for the report, keyed by the group ID found in the config.

GroupEntry Properties

Name Type Description
title string The title of the display group.
description string A brief description of the purpose of the display group.

Example

{
  "perf-metric": {
    "title": "Metrics",
    "description": "These metrics are super cool."
  },
}

artifacts

An object containing gatherer results keyed by gatherer class name. The structure varies by artifact and is not stable. The values of artifacts are subject to change. This property is only available when consuming Lighthouse results programmatically as the artifacts contain trace data and can be quite large (>50MB).

Example

{
  "Offline": 200,
  "HTTPRedirect": {"value": true},
  ...
}