Skip to content

Conversation

zainab-ali
Copy link
Contributor

@zainab-ali zainab-ali commented Jul 4, 2025

Currently, when an expect assertion fails, the developer sees a general assertion failed message along with any clues, but needs to navigate to the source code and look up the failed expectation by its line number. This can be difficult when there are multiple expect statements in the same test.

This PR adds the source code of expect calls to the error message.

Adding just the source code (and not the surrounding lines) has a low maintenance overhead, and is quickest to implement. We can explore adding more context around the source code in future PRs, in a similar fashion to munit.

Current behaviour

image

With this PR

image

Copy link
Collaborator

@Baccata Baccata left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great stuff !

@zainab-ali zainab-ali merged commit 6250f99 into typelevel:main Jul 4, 2025
13 checks passed
@zainab-ali zainab-ali deleted the expect-messaging branch July 4, 2025 18:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants