diff --git a/scripted/sbt/src/main/scala/sbt/test/ScriptedTests.scala b/scripted/sbt/src/main/scala/sbt/test/ScriptedTests.scala index 6e5dc8f38..764ad7916 100644 --- a/scripted/sbt/src/main/scala/sbt/test/ScriptedTests.scala +++ b/scripted/sbt/src/main/scala/sbt/test/ScriptedTests.scala @@ -81,6 +81,7 @@ final class ScriptedTests(resourceBaseDirectory: File, bufferLog: Boolean, launc prescripted(testDirectory) runTest() buffered.info("+ " + label + pendingString) + if (pending) throw new PendingTestSuccessException(label) } catch { case e: xsbt.test.TestException => testFailed() @@ -89,6 +90,9 @@ final class ScriptedTests(resourceBaseDirectory: File, bufferLog: Boolean, launc case _ => e.printStackTrace } if (!pending) throw e + case e: PendingTestSuccessException => + testFailed() + throw e case e: Exception => testFailed() if (!pending) throw e @@ -209,3 +213,7 @@ object CompatibilityLevel extends Enumeration { case Minimal28 => "2.8.1" } } +class PendingTestSuccessException(label: String) extends Exception { + override def getMessage: String = + s"The pending test $label succeeded. Mark this test as passing to remove this failure." +}