static generateReport(result, outputModes) {
    const outputAsArray = Array.isArray(outputModes);
    if (typeof outputModes === 'string') outputModes = [outputModes];

    const output = outputModes.map(outputMode => {
      // HTML report.
      if (outputMode === 'html') {
        if (ReportGenerator.isFlowResult(result)) {
          return ReportGenerator.generateFlowReportHtml(result);
        }
        return ReportGenerator.generateReportHtml(result);
      }
      // CSV report.
      if (outputMode === 'csv') {
        if (ReportGenerator.isFlowResult(result)) {
          throw new Error('CSV output is not support for user flows');
        }
        return ReportGenerator.generateReportCSV(result);
      }
      // JSON report.
      if (outputMode === 'json') {
        return JSON.stringify(result, null, 2);
      }

      throw new Error('Invalid output mode: ' + outputMode);
    });

    return outputAsArray ? output : output[0];
  }
Creates the results output in a format based on the `mode`.
@param {LHResult|FlowResult} result
@param {LHResult['configSettings']['output']} outputModes
@return {string|string[]}