Skip to content

Conversation

@alexandre-abrioux
Copy link
Contributor

@alexandre-abrioux alexandre-abrioux commented Mar 29, 2022

Hi! First, thank you for maintaining this great tool 🙂

Issue

When using a function call for the expect assertion, and throwing an error inside this function, the displayed stack trace does not contain information from where the assertion is called. Instead, it only contains the line where the exception is thrown.

This gets problematic when the assertion method is located in a module different from the test suite. In this case, the test suite is not even referenced. This can be verified in the first commit: b24da85 (those tests will fail).

Solution

The solution resides in the second commit: 3dba4e9.

As you can see, the wrapAssertFn is starting to look very similar to the _assertFunction. In my opinion, the _assertFunction could be removed altogether. However, I did not venture into this as this would probably be a breaking change, because this method is part of the API despite being marked as internal. Please let me know what you think.

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