function getTestRunsReport()

in test-reporter/src/report/get-report.ts [134:162]


function getTestRunsReport(testRuns: TestRunResult[], options: ReportOptions): string[] {
  const sections: string[] = []

  if (testRuns.length > 1 || options.onlySummary) {
    const tableData = testRuns.map((tr, runIndex) => {
      const time = formatTime(tr.time)
      const name = tr.path
      const addr = options.baseUrl + makeRunSlug(runIndex).link
      const nameLink = link(name, addr)
      const passed = tr.passed > 0 ? `${tr.passed}${Icon.success}` : ''
      const failed = tr.failed > 0 ? `${tr.failed}${Icon.fail}` : ''
      const skipped = tr.skipped > 0 ? `${tr.skipped}${Icon.skip}` : ''
      return [nameLink, passed, failed, skipped, time]
    })

    const resultsTable = table(
      ['Report', 'Passed', 'Failed', 'Skipped', 'Time'],
      [Align.Left, Align.Right, Align.Right, Align.Right, Align.Right],
      ...tableData
    )
    sections.push(resultsTable)
  }

  if (options.onlySummary === false) {
    const suitesReports = testRuns.map((tr, i) => getSuitesReport(tr, i, options)).flat()
    sections.push(...suitesReports)
  }
  return sections
}