attemptCleanupFailureDetails static method

List<TestFailureDetails> attemptCleanupFailureDetails(
  1. Iterable<({Object error, StackTrace stackTrace})> failures, {
  2. Object? excludeError,
  3. String phase = 'attemptCleanup',
})

Converts teardown failures into report details for either adapter.

excludeError is used when the selected primary failure is already represented by the result's top-level failure field. Identity matching preserves separate failures that happen to have the same message.

Implementation

static List<TestFailureDetails> attemptCleanupFailureDetails(
  Iterable<({Object error, StackTrace stackTrace})> failures, {
  Object? excludeError,
  String phase = 'attemptCleanup',
}) =>
    [
      for (final failure in failures)
        if (excludeError == null || !identical(failure.error, excludeError))
          TestFailureDetails(
            kind: TestFailureKind.cleanup,
            message: failure.error.toString(),
            phase: phase,
          ),
    ];