private getError()

in test-reporter/src/parsers/dotnet-trx/dotnet-trx-parser.ts [133:165]


  private getError(test: Test): TestCaseError | undefined {
    if (!this.options.parseErrors || !test.error) {
      return undefined
    }

    const error = test.error
    if (
      !Array.isArray(error.Message) ||
      error.Message.length === 0 ||
      !Array.isArray(error.StackTrace) ||
      error.StackTrace.length === 0
    ) {
      return undefined
    }

    const message = test.error.Message[0]
    const stackTrace = test.error.StackTrace[0]
    let path
    let line

    const src = this.exceptionThrowSource(stackTrace)
    if (src) {
      path = src.path
      line = src.line
    }

    return {
      path,
      line,
      message,
      details: `${message}\n${stackTrace}`
    }
  }