These are chat archives for etorreborre/specs2

15th
Nov 2015
Edmondo Porcu
@edmondo1984
Nov 15 2015 16:30
Hello, I discovered a wrong behaviour in the file runner, I was trying to implement an easy fix myself but it doesn't seem there's one
Edmondo Porcu
@edmondo1984
Nov 15 2015 16:38
the overall problem is that I am expecting the files runner to exit with non null value when at least one example has failed, but it doesn't happen. The offending code seems to be this one
  def execute(actions: Action[Unit], arguments: Arguments, exit: Boolean) = {
    val (warnings, result) = actions.run(consoleLogging).unsafePerformIO
    result.fold(
      ok => logUserWarnings(warnings)(consoleLogging) >> IO(exitSystem(0, exit)),
      error => error.fold(
        m      => logUserWarnings(warnings)(consoleLogging) >> consoleLogging(m),
        t      => logUserWarnings(warnings)(consoleLogging) >> logThrowable(t, arguments)(consoleLogging),
        (m, t) => logUserWarnings(warnings)(consoleLogging) >> consoleLogging(m) >> logThrowable(t, arguments)(consoleLogging)
      ) >> IO(exitSystem(100, exit))
    ).unsafePerformIO
  }
because of the exitSystem(0,exit) when the stream of actions is processed without exceptions, even if there are test failures the runner exit with 0 code. This makes it impossible to use it for example as a task in a Gradle built