emchristiansen
emchristiansen

Reputation: 3602

Getting a stack trace from SBT with Scala

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?

Upvotes: 5

Views: 1384

Answers (1)

VonC
VonC

Reputation: 1323115

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).

Upvotes: 2

Related Questions