diff --git a/jvm/core/src/main/scala/org/scalatest/StepwiseNestedSuiteExecution.scala b/jvm/core/src/main/scala/org/scalatest/StepwiseNestedSuiteExecution.scala
index b8ca4040e3..eddc4bb948 100644
--- a/jvm/core/src/main/scala/org/scalatest/StepwiseNestedSuiteExecution.scala
+++ b/jvm/core/src/main/scala/org/scalatest/StepwiseNestedSuiteExecution.scala
@@ -28,7 +28,7 @@ import collection.mutable.ListBuffer
* Trait that causes the nested suites of any suite it is mixed into to be run sequentially even if
* a Distributor
is passed to runNestedSuites
. This trait overrides the
* runNestedSuites
method and fowards every parameter passed to it to a superclass invocation
- * of runNestedSuites
, except it always passes None
for the Distributor
.
+ * of runNestedSuites
, and make sure the nested suites are run and completed one after one in order.
* Mix in this trait into any suite whose nested suites need to be run sequentially even with the rest of the
* run is being executed concurrently.
*/
@@ -69,9 +69,18 @@ trait StepwiseNestedSuiteExecution extends SuiteMixin { thisSuite: Suite =>
val rawString = Resources.suiteCompletedNormally
val formatter = formatterForSuiteCompleted(nestedSuite)
- val duration = System.currentTimeMillis - suiteStartTime
- report(SuiteCompleted(tracker.nextOrdinal(), nestedSuite.suiteName, nestedSuite.suiteId, Some(suiteClassName), Some(duration), formatter, Some(TopOfClass(nestedSuite.getClass.getName)), nestedSuite.rerunner))
- SucceededStatus
+ distributor match {
+ case Some(_) =>
+ status.withAfterEffect {
+ val duration = System.currentTimeMillis - suiteStartTime
+ report(SuiteCompleted(tracker.nextOrdinal(), nestedSuite.suiteName, nestedSuite.suiteId, Some(suiteClassName), Some(duration), formatter, Some(TopOfClass(nestedSuite.getClass.getName)), nestedSuite.rerunner))
+ }
+
+ case None =>
+ val duration = System.currentTimeMillis - suiteStartTime
+ report(SuiteCompleted(tracker.nextOrdinal(), nestedSuite.suiteName, nestedSuite.suiteId, Some(suiteClassName), Some(duration), formatter, Some(TopOfClass(nestedSuite.getClass.getName)), nestedSuite.rerunner))
+ }
+ status
}
catch {
case e: RuntimeException => {