in Sources/XCTest/Public/Asynchronous/XCTestCase+Asynchronous.swift [227:240]
func failIfExpectationsNotWaitedFor(_ expectations: [XCTestExpectation]) {
let orderedUnwaitedExpectations = expectations.filter { !$0.hasBeenWaitedOn }.sorted { $0.creationToken < $1.creationToken }
guard let expectationForFileLineReporting = orderedUnwaitedExpectations.first else {
return
}
let expectationDescriptions = orderedUnwaitedExpectations.map { "'\($0.expectationDescription)'" }.joined(separator: ", ")
let failureDescription = "Failed due to unwaited expectation\(orderedUnwaitedExpectations.count > 1 ? "s" : "") \(expectationDescriptions)"
recordFailure(
description: failureDescription,
at: expectationForFileLineReporting.creationSourceLocation,
expected: false)
}