Skip to content

Commit

Permalink
Add MiMa excludes for breaking changes
Browse files Browse the repository at this point in the history
  • Loading branch information
olafurpg committed Oct 11, 2021
1 parent 995c22b commit a9c06df
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 4 deletions.
24 changes: 21 additions & 3 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import com.typesafe.tools.mima.core.DirectMissingMethodProblem
import com.typesafe.tools.mima.core.ProblemFilters
import com.typesafe.tools.mima.core.MissingTypesProblem
import com.typesafe.tools.mima.core._
import sbtcrossproject.CrossPlugin.autoImport.crossProject
import sbtcrossproject.CrossPlugin.autoImport.CrossType
import scala.collection.mutable
Expand Down Expand Up @@ -85,6 +83,26 @@ lazy val mimaEnable: List[Def.Setting[_]] = List(
),
ProblemFilters.exclude[DirectMissingMethodProblem](
"munit.internal.junitinterface.JUnitComputer.this"
),
// Known breaking changes for MUnit v1
ProblemFilters.exclude[IncompatibleMethTypeProblem](
"munit.FunSuite.munitTestTransform"
),
ProblemFilters.exclude[MissingClassProblem]("munit.GenericAfterEach"),
ProblemFilters.exclude[MissingClassProblem]("munit.GenericBeforeEach"),
ProblemFilters.exclude[MissingClassProblem]("munit.GenericTest"),
ProblemFilters.exclude[DirectMissingMethodProblem](
"munit.MUnitRunner.createTestDescription"
),
ProblemFilters.exclude[IncompatibleMethTypeProblem](
"munit.Suite.beforeEach"
),
ProblemFilters.exclude[IncompatibleMethTypeProblem](
"munit.Suite.afterEach"
),
ProblemFilters.exclude[MissingClassProblem]("munit.Suite$Fixture"),
ProblemFilters.exclude[IncompatibleMethTypeProblem](
"munit.TestTransforms#TestTransform.apply"
)
),
mimaPreviousArtifacts := {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ object PlatformCompat {
task.execute(eventHandler, loggers, _ => p.success(()))
p.future
}

def waitAtMost[T](
future: Future[T],
duration: Duration,
Expand Down
7 changes: 7 additions & 0 deletions munit/jvm/src/main/scala/munit/internal/PlatformCompat.scala
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@ object PlatformCompat {
Future.successful(())
}
private[this] val _blockContext = new ThreadLocal[BlockContext]()
@deprecated("use the overload with an explicit ExecutionContext", "1.0.0")
def waitAtMost[T](
future: Future[T],
duration: Duration
): Future[T] = {
waitAtMost(future, duration, ExecutionContext.global)
}
def waitAtMost[T](
future: Future[T],
duration: Duration,
Expand Down
11 changes: 10 additions & 1 deletion tests/jvm/src/test/scala/munit/TimeoutSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,16 @@ class TimeoutSuite extends munit.FunSuite {
override val munitTimeout: FiniteDuration = Duration(100, "ms")
test("infinite-loop".fail) {
Future {
while (true) {}
while (true) {
def fib(n: Int): Int = {
if (n < 1) 0
else if (n == 1) n
else fib(n - 1) + fib(n - 2)
}
// Some computationally intensive calculation
1.to(1000).foreach(i => fib(i))
println("Loop")
}
}
}
test("fast") {
Expand Down

0 comments on commit a9c06df

Please sign in to comment.