Skip to content

Allow similar use between sync and async checks#2683

Open
natebosch wants to merge 3 commits into
masterfrom
sync-condition-callbacks
Open

Allow similar use between sync and async checks#2683
natebosch wants to merge 3 commits into
masterfrom
sync-condition-callbacks

Conversation

@natebosch

Copy link
Copy Markdown
Member

Towards #2639

Originally async expectations which extract a value also returned a
Subject like synchronous extensions still do, but they were changed to
accept AsyncCondition callback arguments for ergonomics. Add support
for synchronous Condition callbacks on a few expectations that return
subjects for authors who prefer to use the async style for synchronous
checks too.

Affected APIs:

  • Subject.isA
  • Subject.isNotNull
  • Subject<T Function()>.throws
  • Subject<T Function()>.returnsNormally

Restore the Future<Subject> return value from async check extensions
that accept an optional AsyncCondition argument. This allows usage of
other patterns which some authors may feel are better aligned with the
sync checks of the original pattern.

Affected APIs:

  • Subject<Future>.completes
  • Subject<Future>.throws
  • Subject<StreamQueue>.emits
  • Subject<StreamQueue>.emitsError

Refactor tests into finer grained cases and add cases for the new
arguments.

Towards #2639

Originally async expectations which extract a value also returned a
`Subject` like synchronous extensions still do, but they were changed to
accept `AsyncCondition` callback arguments for ergonomics. Add support
for synchronous `Condition` callbacks on a few expectations that return
subjects for authors who prefer to use the async style for synchronous
checks too.

Affected APIs:
- `Subject.isA`
- `Subject.isNotNull`
- `Subject<T Function()>.throws`
- `Subject<T Function()>.returnsNormally`

Restore the `Future<Subject>` return value from async check extensions
that accept an optional `AsyncCondition` argument. This allows usage of
other patterns which some authors may feel are better aligned with the
sync checks of the original pattern.

Affected APIs:
- `Subject<Future>.completes`
- `Subject<Future>.throws`
- `Subject<StreamQueue>.emits`
- `Subject<StreamQueue>.emitsError`

Refactor tests into finer grained cases and add cases for the new
arguments.
@natebosch natebosch requested a review from a team as a code owner June 23, 2026 00:16
@github-actions github-actions Bot added the package:checks Issues related to pkg:checks label Jun 23, 2026
@github-actions

github-actions Bot commented Jun 23, 2026

Copy link
Copy Markdown

PR Health

Changelog Entry ✔️
Package Changed Files

Changes to files need to be accounted for in their respective changelogs.

This check can be disabled by tagging the PR with skip-changelog-check.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

package:checks Issues related to pkg:checks

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant