private getTestCaseError()

in test-reporter/src/parsers/java-junit/java-junit-parser.ts [115:143]


  private getTestCaseError(tc: TestCase): TestCaseError | undefined {
    if (!this.options.parseErrors) {
      return undefined
    }

    // We process <error> and <failure> the same way
    const failures = tc.failure ?? tc.error
    if (!failures) {
      return undefined
    }

    const failure = failures[0]
    const details = typeof failure === 'object' ? failure._ : failure
    let filePath
    let line

    const src = this.exceptionThrowSource(details)
    if (src) {
      filePath = src.filePath
      line = src.line
    }

    return {
      path: filePath,
      line,
      details,
      message: typeof failure === 'object' ? failure.message : undefined
    }
  }