Skip to content

Commit ed4d89d

Browse files
committed
Merge branch 'cheeseng-3.1-wrap-with-fix' into 3.1.x
2 parents 1844d45 + fd9448b commit ed4d89d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

scalatest/src/main/scala/org/scalatest/tools/Framework.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -436,9 +436,7 @@ class Framework extends SbtFramework {
436436
if (accessible || runnable) {
437437
val suite =
438438
try {
439-
if (accessible)
440-
suiteClass.newInstance.asInstanceOf[Suite]
441-
else {
439+
if (runnable) { // When it is runnable WrapWith is available, this will take precedence and this behavior will be consistent with Runner and the old ScalaTestFramework.
442440
val wrapWithAnnotation = suiteClass.getAnnotation(classOf[WrapWith])
443441
val suiteClazz = wrapWithAnnotation.value
444442
val constructorList = suiteClazz.getDeclaredConstructors()
@@ -448,6 +446,8 @@ class Framework extends SbtFramework {
448446
}
449447
constructor.get.newInstance(suiteClass).asInstanceOf[Suite]
450448
}
449+
else
450+
suiteClass.newInstance.asInstanceOf[Suite]
451451
} catch {
452452
case t: Throwable => new DeferredAbortedSuite(suiteClass.getName, t)
453453
}

0 commit comments

Comments
 (0)