lighthouse-core/scripts/lantern/print-correlations.js
/**
 * @param {keyof TargetMetrics} metric
 * @param {keyof LanternMetrics} lanternMetric
 */
@param {keyof TargetMetrics} metric
@param {keyof LanternMetrics} lanternMetric
@param { keyof TargetMetrics } metric @param { keyof LanternMetrics } lanternMetric
function evaluateAndPrintAccuracy(metric, lanternMetric) {
  const actualAccuracy = evaluateAccuracy(entries, metric, lanternMetric);
  const baselineAccuracy = evaluateAccuracy(entries, metric, lanternMetric, 'baseline');
  const baselineOptions = {alwaysGray: !lanternMetric.includes('roughEstimate')};
  const strings = [
    lanternMetric.padEnd(25),
    `${toPercentString(actualAccuracy.p50)} ${toBaselineDiffString(
      actualAccuracy.p50,
      baselineAccuracy.p50,
      baselineOptions
    )}`.padEnd(30),
    `${toPercentString(actualAccuracy.p90)} ${toBaselineDiffString(
      actualAccuracy.p90,
      baselineAccuracy.p90,
      baselineOptions
    )}`.padEnd(30),
    `${toPercentString(actualAccuracy.p95)} ${toBaselineDiffString(
      actualAccuracy.p95,
      baselineAccuracy.p95,
      baselineOptions
    )}`.padEnd(30),
  ];
  allEvaluations.push(...actualAccuracy.evaluations);
  baselineEvaluations.push(...baselineAccuracy.evaluations);
  if (lanternMetric.includes('roughEstimate')) {
    console.log(...strings);
  } else {
    console.log(chalk.gray(...strings));
  }
}
function evaluateAndPrintAccuracy ( metric , lanternMetric ) { const actualAccuracy = evaluateAccuracy ( entries , metric , lanternMetric ) ; const baselineAccuracy = evaluateAccuracy ( entries , metric , lanternMetric , 'baseline' ) ; const baselineOptions = { alwaysGray : ! lanternMetric . includes ( 'roughEstimate' ) } ; const strings = [ lanternMetric . padEnd ( 25 ) , ` ${ toPercentString ( actualAccuracy . p50 ) } ${ toBaselineDiffString ( actualAccuracy . p50 , baselineAccuracy . p50 , baselineOptions ) } ` . padEnd ( 30 ) , ` ${ toPercentString ( actualAccuracy . p90 ) } ${ toBaselineDiffString ( actualAccuracy . p90 , baselineAccuracy . p90 , baselineOptions ) } ` . padEnd ( 30 ) , ` ${ toPercentString ( actualAccuracy . p95 ) } ${ toBaselineDiffString ( actualAccuracy . p95 , baselineAccuracy . p95 , baselineOptions ) } ` . padEnd ( 30 ) , ] ; allEvaluations . push ( ... actualAccuracy . evaluations ) ; baselineEvaluations . push ( ... baselineAccuracy . evaluations ) ; if ( lanternMetric . includes ( 'roughEstimate' ) ) { console . log ( ... strings ) ; } else { console . log ( chalk . gray ( ... strings ) ) ; } }
@param {keyof TargetMetrics} metric
 @param {keyof LanternMetrics} lanternMetric
@param { keyof TargetMetrics } metric @param { keyof LanternMetrics } lanternMetric