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 munit to 1.0.2 #3176

Merged
merged 2 commits into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,7 @@ abstract class BuildTests(server: Boolean) extends TestUtil.ScalaCliBuildSuite {

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

val inputs = TestInputs(
os.rel / "foo.scala" ->
Expand Down
14 changes: 12 additions & 2 deletions modules/build/src/test/scala/scala/build/tests/TestUtil.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,30 @@ import java.util.concurrent.TimeUnit
import scala.concurrent.duration.FiniteDuration

object TestUtil {

abstract class ScalaCliBuildSuite extends munit.FunSuite {
extension (munitContext: BeforeEach | AfterEach) {
def locationAbsolutePath: os.Path =
os.pwd / os.RelPath {
(munitContext match {
case beforeEach: BeforeEach => beforeEach.test
case afterEach: AfterEach => afterEach.test
}).location.path
}
}
override def munitTimeout = new FiniteDuration(120, TimeUnit.SECONDS)
val testStartEndLogger = new Fixture[Unit]("files") {
def apply(): Unit = ()

override def beforeEach(context: BeforeEach): Unit = {
val fileName = os.Path(context.test.location.path).baseName
val fileName = context.locationAbsolutePath.baseName
System.err.println(
s">==== ${Console.CYAN}Running '${context.test.name}' from $fileName${Console.RESET}"
)
}

override def afterEach(context: AfterEach): Unit = {
val fileName = os.Path(context.test.location.path).baseName
val fileName = context.locationAbsolutePath.baseName
System.err.println(
s"X==== ${Console.CYAN}Finishing '${context.test.name}' from $fileName${Console.RESET}"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,25 @@ import java.util.concurrent.TimeUnit
import scala.concurrent.duration.{Duration, FiniteDuration}

abstract class ScalaCliSuite extends munit.FunSuite {
val testStartEndLogger = new Fixture[Unit]("files") {
implicit class BeforeEachOpts(munitContext: BeforeEach) {
def locationAbsolutePath: os.Path = os.pwd / os.RelPath(munitContext.test.location.path)
}

implicit class AfterEachOpts(munitContext: AfterEach) {
def locationAbsolutePath: os.Path = os.pwd / os.RelPath(munitContext.test.location.path)
}
val testStartEndLogger: Fixture[Unit] = new Fixture[Unit]("files") {
def apply(): Unit = ()

override def beforeEach(context: BeforeEach): Unit = {
val fileName = os.Path(context.test.location.path).baseName
val fileName = context.locationAbsolutePath.baseName
System.err.println(
s">==== ${Console.CYAN}Running '${context.test.name}' from $fileName${Console.RESET}"
)
}

override def afterEach(context: AfterEach): Unit = {
val fileName = os.Path(context.test.location.path).baseName
val fileName = context.locationAbsolutePath.baseName
System.err.println(
s"X==== ${Console.CYAN}Finishing '${context.test.name}' from $fileName${Console.RESET}"
)
Expand Down
2 changes: 1 addition & 1 deletion project/deps.sc
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ object Deps {
def metaconfigTypesafe =
ivy"org.scalameta::metaconfig-typesafe-config:0.13.0"
.exclude(("org.scala-lang", "scala-compiler"))
def munit = ivy"org.scalameta::munit:1.0.1"
def munit = ivy"org.scalameta::munit:1.0.2"
def nativeTestRunner = ivy"org.scala-native::test-runner:${Versions.scalaNative}"
def nativeTools = ivy"org.scala-native::tools:${Versions.scalaNative}"
def osLib = ivy"com.lihaoyi::os-lib:0.10.6"
Expand Down
Loading