Context: Writing Scala unit-tests in a project managed by SBT.
When I execute sbt test
to run my unit-tests an assert fails somewhere in my code, I get something like the following (and nothing more)开发者_开发百科:
Test com.reach.ml.test.TestLSHEasy.T0 failed: assertion failed
This tells me which unit-test caused the assert fail, but not which assert it was. If I run the same test directly (not using sbt), I get a whole stack trace, which is very useful for debugging. So my question: How do I get SBT to print out the stack trace when a test crashes?
Regarding xsbt, it might be related to the util.log.StackTrace
object which can trim its output.
The issue 118 illustrated the will of keeping stack traces should be under better control:
so you shouldn't see that trace by default.
Maybe you can wrap your unit test, intercepting any exception, and printing explicitely their full stack trace? (as in Basic.scala
or Boot.scala
).
精彩评论