Uh oh!
There was an error while loading. Please reload this page.
Less discarding of test failure throwables - #183
Conversation
| case Result.Failure(_, maybeCause, _) => maybeCause | ||
| case _ => None | ||
| case Result.Failures(failures) => | ||
| failures.map(_.source).find(_.isDefined).flatten |
There was a problem hiding this comment.
| failures.map(_.source).find(_.isDefined).flatten | |
| failures.collectFirst { | |
| caseResult.Failure(_, Some(cause), _) => cause | |
| } |
zainab-ali
commented
Aug 12, 2025
Thanks! My only concern (which doesn't need to be addressed) is that we're only taking the first failure and discarding others. If this ends up being a problem, we could define |
... and more propagating thereof. On one end, it seems a shame to discard information that we have. On the other end, receiver of the `sbt.testing.Event` - in my case, [Gradle plugin for multi-backend Scala](https://github.com/dubinsky/scalajs-gradle) - has to provide a throwable to Gradle, which requires one to accompany a test failure, and if it is not propagated by the test framework, a fake throwable has to be concocted (ugh). This change makes the ends meet ;)
dubinsky
commented
Aug 12, 2025
Yes, this asymmetricity bothers me too; but for test failure reporting, one - any one! - is better than none... |
Baccata
left a comment
There was a problem hiding this comment.
I think this is good enough for now, in the sense that it makes the library better for a rather niche usecase without impacting the majority.
dubinsky
commented
Aug 13, 2025
Reporting the cause of the test failure does not seem like an niche use case to me; do I need to do anything for this to get merged? |
dubinsky
commented
Aug 13, 2025
A little more context: there is no throwable in the Thanks! |
Baccata
commented
Aug 14, 2025
That is what I meant. My point is that if mistake there is, you're the first reporter in years being noticeably impacted by it, hence the "niche" denomination. I presume the use of Gradle is what led for this to be noticed, and Gradle is a somewhat niche build-tool in the Scala community. Didn't mean anything more by it, providing a mitigation is indeed important. We can start with the mitigation you implemented in this PR and take the time to assess what should be done for a more proper fix. |
Uh oh!
There was an error while loading. Please reload this page.
dubinsky
commented
Aug 14, 2025
Thanks! |
... and more propagating thereof.
On one end, it seems a shame to discard information that we have.
On the other end, receiver of the
sbt.testing.Event- in my case, Gradle plugin for multi-backend Scala - has to provide a throwable to Gradle, which requires one to accompany a test failure, and if it is not propagated by the test framework, a fake throwable has to be concocted (ugh).This change makes the ends meet ;)