Skip to content

Support testing expectations on StackTraces for thrown exceptions #2706

Open

Description

@natebosch

The .throws() expectation on both Function() and Future subjects allows checking further details about the thrown object, but does not expose the stack trace at all for testing. This is also what matcher supports, and testing expectations on stack traces is rare.

If we had only the Condition (or as a class or callback) style arguments we could add a second optional argument for a condition to check the stack trace, but this design doesn't work as well with the model where we return a Subject or Future<Subject>.

We could use Subject<({Object error, StackTrace stackTrace})>, but this would require reading the error getter for each use.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    package:checksIssues related to pkg:checks

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions