From c94a4457371356e5191b46262f88972bd92160da Mon Sep 17 00:00:00 2001 From: jvican Date: Tue, 2 May 2017 01:22:15 +0200 Subject: [PATCH] Use scripted hook to run reload This saves us from duplicating error handling logic to correctly manage `pending` tests whose projects don't even load (and make our reload) fail. --- scripted/sbt/src/main/scala/sbt/test/ScriptedTests.scala | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/scripted/sbt/src/main/scala/sbt/test/ScriptedTests.scala b/scripted/sbt/src/main/scala/sbt/test/ScriptedTests.scala index 13e4d0fa6..573905b88 100644 --- a/scripted/sbt/src/main/scala/sbt/test/ScriptedTests.scala +++ b/scripted/sbt/src/main/scala/sbt/test/ScriptedTests.scala @@ -145,8 +145,12 @@ final class ScriptedTests(resourceBaseDirectory: File, val sbtHandler = handlers.getOrElse('>', sys.error("Missing sbt handler.")) val statement = Statement(";reload;initialize", Nil, successExpected = true, line = -1) - runner.processStatement(sbtHandler.asInstanceOf[SbtHandler], statement, states) - commonRunTest(label, tempTestDir, preHook, handlers, runner, states, buffer) + // Run reload inside the hook to reuse error handling for pending tests + val wrapHook = (file: File) => { + preHook(file) + runner.processStatement(sbtHandler.asInstanceOf[SbtHandler], statement, states) + } + commonRunTest(label, tempTestDir, wrapHook, handlers, runner, states, buffer) } // Run the test and delete files (except global that holds local scala jars)