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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clues don't get reported for some assertions #2720

Closed
cuchaz opened this issue Dec 8, 2021 · 4 comments
Closed

Clues don't get reported for some assertions #2720

cuchaz opened this issue Dec 8, 2021 · 4 comments
Labels
assertions 🔍 Related to the assertion mechanisms within the testing framework. bug 🐛 Issues that report a problem or error in the code.
Milestone

Comments

@cuchaz
Copy link

cuchaz commented Dec 8, 2021

Which version of Kotest are you using
4.5.0

Hello,

Some assertions don't collect clue information before being thrown, so the clue information never shows up in the failure reports.

Specifically, I noticed these null-handling functions seem to bypass the clue system in my tests:

https://github.com/kotest/kotest/blob/master/kotest-assertions/kotest-assertions-shared/src/commonMain/kotlin/io/kotest/assertions/eq/Eq.kt#L56

I've only just glanced at the source code, but It looks like throwing Assertions directly, rather than calling the failure function, doesn't collect the clue information before it gets popped off the stack?

Those are instances I know of so far, but maybe other assertion functions that throw raw Errors could cause the same problem?

Btw, I'm a longtime Kotest user. Love your project! =D

@sksamuel
Copy link
Member

sksamuel commented Dec 8, 2021 via email

@cuchaz
Copy link
Author

cuchaz commented Dec 8, 2021

I just upgraded to 4.6.4. The problem still happens.

Thanks for looking into it.

@sksamuel
Copy link
Member

sksamuel commented Dec 9, 2021 via email

@sksamuel sksamuel added assertions 🔍 Related to the assertion mechanisms within the testing framework. bug 🐛 Issues that report a problem or error in the code. labels Dec 10, 2021
@sksamuel sksamuel added this to the 5.0.2 milestone Dec 10, 2021
@sksamuel
Copy link
Member

Fixed in 5.0.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
assertions 🔍 Related to the assertion mechanisms within the testing framework. bug 🐛 Issues that report a problem or error in the code.
Projects
None yet
Development

No branches or pull requests

2 participants