Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add stacktrace to failed expect function call #767

Merged
merged 2 commits into from Oct 3, 2022
Merged

fix: add stacktrace to failed expect function call #767

merged 2 commits into from Oct 3, 2022

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.

@titanism titanism merged commit e064b5a into ladjs:master Oct 3, 2022
titanism added a commit that referenced this pull request Oct 4, 2022
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.

None yet

2 participants