score:5
As an alternative to getting SBT to print the full stack trace, could you put a try
-catch
block around your test runner? For example, from the REPL:
scala> try { throw new Exception } catch { case e => e }
res1: java.lang.Throwable = java.lang.Exception
scala> res1.printStackTrace
java.lang.Exception
at $line2.$read$$iw$$iw$.liftedTree1$1(<console>:8)
at $line2.$read$$iw$$iw$.<init>(<console>:8)
at $line2.$read$$iw$$iw$.<clinit>(<console>)
...
score:70
Using hints found in the documentation here:
(quoted)
You can configure the output shown when running with sbt in four ways: 1) turn off color, 2) show short stack traces, 3) full stack traces, and 4) show durations for everything. To do so you must pass a -o argument to ScalaTest, and after the -o, place any combination of:
- D - show durations
- S - show short stack traces
- F - show full stack traces
- W - without color
For example, "-oDF" would show full stack traces and durations (the amount of time spent in each test).
To pass arguments from sbt to ScalaTest you can either add test options globally, like this:
testOptions in Test += Tests.Argument("-oD")
(See the website for the rest of the quote)
You can use the following sbt command to enable full stack traces in tests:
> set testOptions in YourProjectName += Tests.Argument("-oF")
Per Sasha's comment, this can also be done from the command line per test run as shown below.
$ sbt test -- -oF
Source: stackoverflow.com
Related Query
- How can I get complete stacktraces for exceptions thrown in tests when using sbt and testng?
- How to run sbt tests for debugging when debug is disabled by default?
- How to get ScalaTest correctly reporting tests results when using scalacheck with Propspec and PropertyCheck?
- How can i publish snapshots when using sbt with the bintray-sbt plugin?
- Cats Effect IO - how do I ensure thrown exceptions are captured as values when using attempt / redeem "inside" a top level flatmap?
- How to get javadoc when using sbt and Eclipse?
- How can I get list of all the tests in a test class implemented using ScalaTest?
- How can I skip tests in an SBT build?
- How can I pass JVM options to SBT to use when running the app or test cases?
- How can I avoid mutable variables in Scala when using ZipInputStreams and ZipOutpuStreams?
- How do I get hold of exceptions thrown in a Scala Future?
- How can I enable remote debugging for SBT in windows?
- How can I fix missing conf files when using shadowJar and Scala dependencies?
- How to test for additional properties of expected Exceptions using ScalaTest
- How can I get a Random URL on http request for Gatling?
- Exclude Specifically Tagged tests from SBT when using ScalaTest
- How to get a list of defined tests in sbt project in sbt 0.12?
- How can I get colored output from Maven and SBT on Windows?
- How to complete a request in another actor when using akka-http
- How do I get started developing for a web using Scala?
- How can I get all object vals and subobject vals using reflection in Scala?
- How can I create a TF-IDF for Text Classification using Spark?
- How can you get ScalaFX to play nice in the SBT console?
- How to set settings for a subproject in sbt shell (without using project command)?
- How can I get a Node adjacent to a unique Node using Scala?
- sbt test-only not picking up jvm option when forking a jvm for tests
- How can I customize Scala ambiguous implicit errors when using shapeless type inequalities
- Scala - how to get the 'type' for a field using reflection api
- How can I get random data generated for scala case classes with the ability to "change some values" for unit testing?
- compilation nap - How can I make sbt to ring a bell when compilation is ready?
More Query from same tag
- Behavior of Future map and foreach
- How to remove datatype from value in config file with typesafe?
- How to use SORM framework with Play Framework?
- pattern matching fails on second try
- How to get Slick create table statements to use InnoDB
- Spring Jackson Serialization of Scala Enumeration
- Automatically inferred generic type in trait
- Spark DataFrame handing empty String in OneHotEncoder
- Combining Spark schema without duplicates?
- scala macro with a import statement not working
- Converting Option[T] to Option[U] in Scala
- SBT doesnt care of scalaversion
- How does reduceByKey work
- List processing in DStream
- How does Scala's equals method work in the case of a List?
- How to get beginning of day of any epochtime in scala?
- Anorm (Scala) How to return Json from a joint table?
- What is the proper way to chain Akka Actor Ask calls?
- for comprehension with tuple, withFilter is not a member error
- IntelliJ IDEA and Play framework integration - how to compile on edits?
- Spark Dataframe write to kafka topic in avro format?
- val cond: (Int, Int) => Boolean = (...) what does this scala code mean?
- When calling Python as a subprocess, can I force it to run in interactive mode?
- Importing a Scala project from github into Eclipse
- How to make this recursive method tail recursive in Scala?
- Scala converters convert Java collections to Wrapper objects
- Scala nested case class self-bounding inheritance
- Cannot run unit test on scala playframework
- How to use Jerkson with Enumerations?
- Scala - Map join values to keys?