Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to munit 1.0.0-M6 #210

Merged
merged 6 commits into from
Aug 3, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ThisBuild / tlBaseVersion := "1.0"
ThisBuild / tlBaseVersion := "2.0"

ThisBuild / developers += tlGitHubDev("mpilquist", "Michael Pilquist")
ThisBuild / startYear := Some(2021)
Expand Down Expand Up @@ -28,7 +28,7 @@ lazy val munit = crossProject(JSPlatform, JVMPlatform)
.dependsOn(core)
.settings(
libraryDependencies ++= List(
"org.scalameta" %%% "munit-scalacheck" % "0.7.29",
"org.scalameta" %%% "munit-scalacheck" % "1.0.0-M5",
"org.typelevel" %%% "cats-effect" % "3.3.11" % Test
)
)
12 changes: 6 additions & 6 deletions munit/shared/src/main/scala/munit/ScalaCheckEffectSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
package munit

import cats.implicits._
import org.scalacheck.{Gen, Test}
import org.scalacheck.{Gen, Test => ScalaCheckTest}
import org.scalacheck.Test.PropException
import org.scalacheck.effect.PropF
import org.scalacheck.rng.Seed
Expand Down Expand Up @@ -51,7 +51,7 @@ trait ScalaCheckEffectSuite extends ScalaCheckSuite {
val testResultTransform =
new ValueTransform(
"ScalaCheck TestResult",
{ case p: Test.Result =>
{ case p: ScalaCheckTest.Result =>
super.munitValueTransform(parseTestResult(p))
}
)
Expand All @@ -72,7 +72,7 @@ trait ScalaCheckEffectSuite extends ScalaCheckSuite {
prop.check(scalaCheckTestParameters, genParameters).map(fixResultException).map(parseTestResult)
}

private def parseTestResult(result: Test.Result)(implicit loc: Location): Unit = {
private def parseTestResult(result: ScalaCheckTest.Result)(implicit loc: Location): Unit = {
if (!result.passed) {
val seed = genParameters.initialSeed.get
val seedMessage =
Expand All @@ -85,7 +85,7 @@ trait ScalaCheckEffectSuite extends ScalaCheckSuite {
}
}

private def fixResultException(result: Test.Result): Test.Result =
private def fixResultException(result: ScalaCheckTest.Result): ScalaCheckTest.Result =
result.copy(
status = result.status match {
case p @ PropException(_, e, _) => p.copy(e = rootCause(e))
Expand All @@ -96,8 +96,8 @@ trait ScalaCheckEffectSuite extends ScalaCheckSuite {
// https://github.com/scalameta/munit/blob/68c2d13868baec9a77384f11f97505ecc0ce3eba/munit/shared/src/main/scala/munit/MUnitRunner.scala#L318-L326
@tailrec
private def rootCause(x: Throwable): Throwable = x match {
case _: InvocationTargetException | _: ExceptionInInitializerError |
_: UndeclaredThrowableException | _: ExecutionException if x.getCause != null =>
// should also include InvocationTargetException and UndeclaredThrowableException, but not on SJS
case _: ExceptionInInitializerError | _: ExecutionException if x.getCause != null =>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These exceptions don't link for Scala.js. I'm not sure how much they matter. If anyone JVM-side complains we can always split this code cross-platform or something /shrug

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note the PR that fixed this was observing an ExecutionException

rootCause(x.getCause)
case _ => x
}
Expand Down