Skip to content

Add checks for calls to exit#2642

Draft
natebosch wants to merge 4 commits into
masterfrom
exits-check
Draft

Add checks for calls to exit#2642
natebosch wants to merge 4 commits into
masterfrom
exits-check

Conversation

@natebosch

@natebosch natebosch commented May 15, 2026

Copy link
Copy Markdown
Member

As suggested in #2640
Closes #1657

An extension on T Function() allows expectations that the callback
synchronously calls exit and returns a subject to check expectations
on the exit code.

An extension on Future<T> Function() allows expectations that the
returned future does not complete before a call to exit is made. This
catches both synchronous and asynchronous exits. The extension on type
is more specific so it is possible to use the asynchronous code path in
cases with statically asynchronous callbacks.

As suggested in #2640

An extension on `T Function()` allows expectations that the callback
synchronously calls `exit` and returns a subject to check expectations
on the exit code.

An extension on `Future<T> Function()` allows expectations that the
returned future does not complete before a call to `exit` is made. This
catches both synchronous and asynchronous exits. The extension `on` type
is more specific so it is possible to use the asynchronous code path in
cases with statically asynchronous callbacks.
@github-actions github-actions Bot added the package:checks Issues related to pkg:checks label May 15, 2026
@github-actions

github-actions Bot commented May 15, 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.

Provide a warning for when a test called exit()

1 participant