Skip to content

Commit 0593e4c

Browse files
Update munit to 1.0.2 (#3176)
* Update munit to 1.0.2 * Fix errors tied to `munit` 1.0.2 location paths changing from absolute to relative --------- Co-authored-by: Piotr Chabelski <ged.subfan@gmail.com>
1 parent 793f91c commit 0593e4c

File tree

4 files changed

+24
-7
lines changed

4 files changed

+24
-7
lines changed

modules/build/src/test/scala/scala/build/tests/BuildTests.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -596,7 +596,7 @@ abstract class BuildTests(server: Boolean) extends TestUtil.ScalaCliBuildSuite {
596596

597597
test("cli dependency options shadowing using directives") {
598598
val usingDependency = "org.scalameta::munit::1.0.0-M1"
599-
val cliDependency = "org.scalameta::munit::1.0.1"
599+
val cliDependency = "org.scalameta::munit::1.0.2"
600600

601601
val inputs = TestInputs(
602602
os.rel / "foo.scala" ->

modules/build/src/test/scala/scala/build/tests/TestUtil.scala

+12-2
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,30 @@ import java.util.concurrent.TimeUnit
88
import scala.concurrent.duration.FiniteDuration
99

1010
object TestUtil {
11+
1112
abstract class ScalaCliBuildSuite extends munit.FunSuite {
13+
extension (munitContext: BeforeEach | AfterEach) {
14+
def locationAbsolutePath: os.Path =
15+
os.pwd / os.RelPath {
16+
(munitContext match {
17+
case beforeEach: BeforeEach => beforeEach.test
18+
case afterEach: AfterEach => afterEach.test
19+
}).location.path
20+
}
21+
}
1222
override def munitTimeout = new FiniteDuration(120, TimeUnit.SECONDS)
1323
val testStartEndLogger = new Fixture[Unit]("files") {
1424
def apply(): Unit = ()
1525

1626
override def beforeEach(context: BeforeEach): Unit = {
17-
val fileName = os.Path(context.test.location.path).baseName
27+
val fileName = context.locationAbsolutePath.baseName
1828
System.err.println(
1929
s">==== ${Console.CYAN}Running '${context.test.name}' from $fileName${Console.RESET}"
2030
)
2131
}
2232

2333
override def afterEach(context: AfterEach): Unit = {
24-
val fileName = os.Path(context.test.location.path).baseName
34+
val fileName = context.locationAbsolutePath.baseName
2535
System.err.println(
2636
s"X==== ${Console.CYAN}Finishing '${context.test.name}' from $fileName${Console.RESET}"
2737
)

modules/integration/src/test/scala/scala/cli/integration/ScalaCliSuite.scala

+10-3
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,25 @@ import java.util.concurrent.TimeUnit
55
import scala.concurrent.duration.{Duration, FiniteDuration}
66

77
abstract class ScalaCliSuite extends munit.FunSuite {
8-
val testStartEndLogger = new Fixture[Unit]("files") {
8+
implicit class BeforeEachOpts(munitContext: BeforeEach) {
9+
def locationAbsolutePath: os.Path = os.pwd / os.RelPath(munitContext.test.location.path)
10+
}
11+
12+
implicit class AfterEachOpts(munitContext: AfterEach) {
13+
def locationAbsolutePath: os.Path = os.pwd / os.RelPath(munitContext.test.location.path)
14+
}
15+
val testStartEndLogger: Fixture[Unit] = new Fixture[Unit]("files") {
916
def apply(): Unit = ()
1017

1118
override def beforeEach(context: BeforeEach): Unit = {
12-
val fileName = os.Path(context.test.location.path).baseName
19+
val fileName = context.locationAbsolutePath.baseName
1320
System.err.println(
1421
s">==== ${Console.CYAN}Running '${context.test.name}' from $fileName${Console.RESET}"
1522
)
1623
}
1724

1825
override def afterEach(context: AfterEach): Unit = {
19-
val fileName = os.Path(context.test.location.path).baseName
26+
val fileName = context.locationAbsolutePath.baseName
2027
System.err.println(
2128
s"X==== ${Console.CYAN}Finishing '${context.test.name}' from $fileName${Console.RESET}"
2229
)

project/deps.sc

+1-1
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ object Deps {
184184
def metaconfigTypesafe =
185185
ivy"org.scalameta::metaconfig-typesafe-config:0.13.0"
186186
.exclude(("org.scala-lang", "scala-compiler"))
187-
def munit = ivy"org.scalameta::munit:1.0.1"
187+
def munit = ivy"org.scalameta::munit:1.0.2"
188188
def nativeTestRunner = ivy"org.scala-native::test-runner:${Versions.scalaNative}"
189189
def nativeTools = ivy"org.scala-native::tools:${Versions.scalaNative}"
190190
def osLib = ivy"com.lihaoyi::os-lib:0.10.6"

0 commit comments

Comments
 (0)