export async function parseTestReports()

in action-junit-report/src/testParser.ts [358:411]


export async function parseTestReports(
  checkName: string,
  summary: string,
  reportPaths: string,
  suiteRegex: string,
  annotatePassed = false,
  checkRetries = false,
  excludeSources: string[],
  checkTitleTemplate: string | undefined = undefined,
  testFilesPrefix = '',
  transformer: Transformer[]
): Promise<TestResult> {
  core.debug(`Process test report for: ${reportPaths} (${checkName})`)
  const globber = await glob.create(reportPaths, {followSymbolicLinks: false})
  let annotations: Annotation[] = []
  let totalCount = 0
  let skipped = 0
  for await (const file of globber.globGenerator()) {
    core.debug(`Parsing report file: ${file}`)

    const {
      totalCount: c,
      skipped: s,
      annotations: a
    } = await parseFile(
      file,
      suiteRegex,
      annotatePassed,
      checkRetries,
      excludeSources,
      checkTitleTemplate,
      testFilesPrefix,
      transformer
    )
    if (c === 0) continue
    totalCount += c
    skipped += s
    annotations = annotations.concat(a)
  }

  // get the count of passed and failed tests.
  const failed = annotations.filter(a => a.annotation_level === 'failure').length
  const passed = totalCount - failed - skipped

  return {
    checkName,
    summary,
    totalCount,
    skipped,
    failed,
    passed,
    annotations
  }
}