etorreborre/specs2

`TimeoutException` causes `NullPointerException`, test to be skipped

armanbilge opened this issue ยท 4 comments

This one has created a bit of confusion for us over in Cats Effect ๐Ÿ˜…

libraryDependencies += "org.specs2" %% "specs2-core" % "4.16.0"
import org.specs2.mutable._
import org.specs2.specification.core.Execution
import scala.concurrent._

class FooSpec extends Specification {

  "foo" should {
    "not be skipped" in {
      val p = Promise[Boolean]()
      p.tryFailure(new TimeoutException)
      p.future
    }
  }

}
sbt:sandbox> test
[info] FooSpec
[info] foo should
[error] stack trace is suppressed; run last Test / test for the full output
[error] Error: Total 2, Failed 0, Errors 1, Passed 0, Skipped 1
[error] Error during tests:
[error]         FooSpec
[error] (Test / test) sbt.TestsFailedException: Tests unsuccessful
[error] Total time: 1 s, completed Jun 30, 2022, 4:35:23 PM
sbt:sandbox> last Test / test
[debug] Running TaskDef(FooSpec, specs2 Specification fingerprint, false, [SuiteSelector])
[info] FooSpec
[info] foo should
[error] java.lang.NullPointerException
[error]         at org.specs2.reporter.TextPrinter.printSkipped(TextPrinter.scala:181)
[error]         at org.specs2.reporter.TextPrinter.printSkipped$(TextPrinter.scala:178)
[error]         at org.specs2.reporter.TextPrinter$.printSkipped(TextPrinter.scala:292)
[error]         at org.specs2.reporter.TextPrinter.printResult$1(TextPrinter.scala:130)
[error]         at org.specs2.reporter.TextPrinter.printExecutable(TextPrinter.scala:146)
[error]         at org.specs2.reporter.TextPrinter.printExecutable$(TextPrinter.scala:118)
[error]         at org.specs2.reporter.TextPrinter$.printExecutable(TextPrinter.scala:292)
[error]         at org.specs2.reporter.TextPrinter.$anonfun$printFragment$2(TextPrinter.scala:100)
[error]         at org.specs2.control.eff.Arrs.$anonfun$map$2(Eff.scala:368)
[error]         at org.specs2.control.eff.Arrs.go$1(Eff.scala:383)
[error]         at org.specs2.control.eff.Arrs.apply(Eff.scala:399)
[error]         at org.specs2.control.eff.Interpret.$anonfun$interpretLoop$11(Interpret.scala:198)
[error]         at org.specs2.control.eff.Arrs.go$1(Eff.scala:380)
[error]         at org.specs2.control.eff.Arrs.apply(Eff.scala:399)
[error]         at org.specs2.control.eff.CollectedUnions.$anonfun$othersEff$1(Unions.scala:97)
[error]         at org.specs2.control.eff.Arrs.go$1(Eff.scala:383)
[error]         at org.specs2.control.eff.Arrs.apply(Eff.scala:399)
[error]         at org.specs2.control.eff.Interpret.$anonfun$interpretLoop$11(Interpret.scala:198)
[error]         at org.specs2.control.eff.Arrs.go$1(Eff.scala:380)
[error]         at org.specs2.control.eff.Arrs.apply(Eff.scala:399)
[error]         at org.specs2.control.eff.CollectedUnions.$anonfun$othersEff$1(Unions.scala:97)
[error]         at org.specs2.control.eff.Arrs.go$1(Eff.scala:380)
[error]         at org.specs2.control.eff.Arrs.apply(Eff.scala:399)
[error]         at org.specs2.control.eff.Interpret.$anonfun$interpretLoop$11(Interpret.scala:198)
[error]         at org.specs2.control.eff.Arrs.go$1(Eff.scala:380)
[error]         at org.specs2.control.eff.Arrs.apply(Eff.scala:399)
[error]         at org.specs2.control.eff.CollectedUnions.$anonfun$othersEff$1(Unions.scala:97)
[error]         at org.specs2.control.eff.Arrs.go$1(Eff.scala:383)
[error]         at org.specs2.control.eff.Arrs.apply(Eff.scala:399)
[error]         at org.specs2.control.eff.Interpret.$anonfun$interpretLoop$11(Interpret.scala:198)
[error]         at org.specs2.control.eff.Arrs.go$1(Eff.scala:380)
[error]         at org.specs2.control.eff.Arrs.apply(Eff.scala:399)
[error]         at org.specs2.control.eff.CollectedUnions.$anonfun$othersEff$1(Unions.scala:97)
[error]         at org.specs2.control.eff.Arrs.go$1(Eff.scala:383)
[error]         at org.specs2.control.eff.Arrs.apply(Eff.scala:399)
[error]         at org.specs2.control.eff.IntoPolyLower4$$anon$15.$anonfun$apply$62(IntoPoly.scala:220)
[error]         at org.specs2.control.eff.Arrs.go$1(Eff.scala:380)
[error]         at org.specs2.control.eff.Arrs.apply(Eff.scala:399)
[error]         at org.specs2.control.eff.IntoPolyLower4$$anon$15.$anonfun$apply$62(IntoPoly.scala:220)
[error]         at org.specs2.control.eff.Arrs.go$1(Eff.scala:380)
[error]         at org.specs2.control.eff.Arrs.apply(Eff.scala:399)
[error]         at org.specs2.control.eff.EffInterpretation.$anonfun$detachA$8(Eff.scala:316)
[error]         at org.specs2.fp.Monad.$anonfun$map$2(Monad.scala:22)
[error]         at org.specs2.control.eff.TimedFuture$$anon$2.$anonfun$point$2(FutureEffect.scala:57)
[error]         at org.specs2.control.eff.TimedFuture.$anonfun$runNow$1(FutureEffect.scala:15)
[error]         at scala.Option.fold(Option.scala:251)
[error]         at org.specs2.control.eff.TimedFuture.runNow(FutureEffect.scala:16)
[error]         at org.specs2.control.eff.TimedFuture$$anon$2.$anonfun$bind$2(FutureEffect.scala:60)
[error]         at scala.concurrent.Future.$anonfun$flatMap$1(Future.scala:307)
[error]         at scala.concurrent.impl.Promise.$anonfun$transformWith$1(Promise.scala:41)
[error]         at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:64)
[error]         at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
[error]         at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
[error]         at java.base/java.lang.Thread.run(Thread.java:829)
[debug] Summary for specs2 not available.
[error] Error: Total 2, Failed 0, Errors 1, Passed 0, Skipped 1
[error] Error during tests:
[error]         FooSpec
[error] (Test / test) sbt.TestsFailedException: Tests unsuccessful

Ouch, null values FTW. A fix is on the way.

Thanks!

@etorreborre we were just saying the other day how above-and-beyond responsive and helpful you are. We really really appreciate it ๐Ÿ™

4.16.1 and 5.0.2 are now published.

@etorreborre we were just saying the other day how above-and-beyond responsive and helpful you are. We really really appreciate it ๐Ÿ™

I'm happy to fix my own mistakes :-)