How to use the lighthouse.Audit.makeTableDetails function in lighthouse

To help you get started, we’ve selected a few lighthouse examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github treosh / exthouse / src / utils / analysis.js View on Github external
function getExtensionExtraFiles(lhResult) {
  const headings = lhResult.audits['bootup-time'].details.headings
  const items = getExtensionFiles(lhResult)
  const numericValue = items.length
  const score = Audit.computeLogNormalScore(numericValue, 0.5, 2) // 0 is optiomal
  return {
    id: 'exthouse-extension-files',
    title: 'Extension files',
    description:
      'Extension files add extra CPU consumption for every URL visit. Bundle resources into one and leverage hot chaching. [Learn more](https://v8.dev/blog/code-caching-for-devs).',
    score,
    scoreDisplayMode: 'numeric',
    numericValue,
    displayValue: `${numericValue} file${numericValue !== 1 ? 's' : ''}`,
    details: Audit.makeTableDetails(headings, items)
  }
}
github treosh / exthouse / src / utils / analysis.js View on Github external
{ key: 'startTime', itemType: 'text', text: 'Start Time' },
    { key: 'duration', itemType: 'text', text: 'Duration' }
  ]
  const items = longTasks.map(task => ({
    startTime: `${formatMsValue(task.startTime)} ms`,
    duration: `${formatMsValue(task.duration)} ms`
  }))
  return {
    id: 'exthouse-new-long-tasks',
    title: 'Added Long Tasks',
    description: `The value represents a sum of [Long Tasks](https://developer.mozilla.org/en-US/docs/Web/API/Long_Tasks_API) added by extension. The table displays all long tasks occured.`,
    score,
    scoreDisplayMode: 'numeric',
    numericValue,
    displayValue: `${formatMsValue(numericValue)} ms`,
    details: Audit.makeTableDetails(headings, items) // FIXME: display only new tasks
  }
}
github treosh / lighthouse-plugin-field-performance / src / utils / audit-helpers.js View on Github external
const normMax = formatValue(max, { isMs: isMs(timeUnit) })

    if (min === 0) {
      item.category = `Fast (faster than ${normMax} ${timeUnit})`
    } else if (max && min === distributions[index - 1].max) {
      item.category = `Average (from ${normMin} ${timeUnit} to ${normMax} ${timeUnit})`
    } else {
      item.category = `Slow (longer than ${normMin} ${timeUnit})`
    }

    item.distribution = `${(proportion * 100).toFixed()} %`

    return item
  })

  return Audit.makeTableDetails(headings, items)
}
github thegreenwebfoundation / lighthouse-plugin-greenhouse / src / audits / greenhouse-audit.js View on Github external
const [first, ...rest] = checks
    const sortedRest = sortBy(rest, ["hostedby", "green"])
    const sortedChecks = [first, ...sortedRest]

    const results = sortedChecks.map(check => {
        const url = `https://${check.url}`
        const hostedby = check.hostedby
        const green = check.green ? "Green" : "Grey"
        const gwfLink = {
          type: "link",
          text: "view report",
          url: `https://www.thegreenwebfoundation.org/green-web-check/?url=${url}`
        }
        return { url , hostedby, green, gwfLink }
      })
    return Audit.makeTableDetails(headings, results)
  }