com-lihaoyi / utest

A simple testing framework for Scala

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Filter stack trace in error output

bwbecker opened this issue · comments

Here are some example stack traces in utest output:

X example.HelloSpec.test3 0ms 
  java.lang.IndexOutOfBoundsException: 10
    scala.collection.LinearSeqOptimized.apply(LinearSeqOptimized.scala:63)
    scala.collection.LinearSeqOptimized.apply$(LinearSeqOptimized.scala:61)
    scala.collection.immutable.List.apply(List.scala:85)
    example.HelloSpec$.$anonfun$tests$4(HelloSpec.scala:29)
X example.HelloSpec.test4 3ms 
  java.lang.AssertionError: assertion failed: ==> assertion failed: 1 != 2
    scala.Predef$.assert(Predef.scala:219)
    utest.asserts.Asserts$ArrowAssert.$eq$eq$greater(Asserts.scala:193)
    example.HelloSpec$.$anonfun$tests$5(HelloSpec.scala:33)

I think most of the time the part of the trace from utest itself (utest.asserts.Assert) and the scala library (scala.*) aren't useful.

Would the project maintainers welcome a pull request that added a feature where the user could provide a function to filter the stack trace? It would probably be modelled on exceptionStackFrameHighlighter with exceptionIncludeStackTraceElement(s:StackTraceElement):Boolean = true as the default.