Skip to content

Polling expectations (under Experimental spi) #1115

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Sources/Testing/Issues/Issue.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ public struct Issue: Sendable {
/// confirmed too few or too many times.
indirect case confirmationMiscounted(actual: Int, expected: any RangeExpression & Sendable)

@_spi(Experimental)
case confirmationPollingFailed

/// An issue due to an `Error` being thrown by a test function and caught by
/// the testing library.
///
Expand Down Expand Up @@ -286,6 +289,8 @@ extension Issue.Kind: CustomStringConvertible {
}
}
return "Confirmation was confirmed \(actual.counting("time")), but expected to be confirmed \(String(describingForTest: expected)) time(s)"
case .confirmationPollingFailed:
return "Confirmation polling failed"
case let .errorCaught(error):
return "Caught error: \(error)"
case let .timeLimitExceeded(timeLimitComponents: timeLimitComponents):
Expand Down Expand Up @@ -465,6 +470,8 @@ extension Issue.Kind {
.expectationFailed(Expectation.Snapshot(snapshotting: expectation))
case .confirmationMiscounted:
.unconditional
case .confirmationPollingFailed:
.unconditional
case let .errorCaught(error), let .valueAttachmentFailed(error):
.errorCaught(ErrorSnapshot(snapshotting: error))
case let .timeLimitExceeded(timeLimitComponents: timeLimitComponents):
Expand Down
Loading