Skip to content

Commit

Permalink
enable DottyJS
Browse files Browse the repository at this point in the history
  • Loading branch information
larsrh committed Nov 8, 2020
1 parent 3a440f2 commit 44b0edb
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 15 deletions.
10 changes: 6 additions & 4 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ val sharedJVMSettings: List[Def.Setting[_]] = List(
) ++ mimaEnable
val sharedJSSettings: List[Def.Setting[_]] = List(
skipIdeaSettings,
crossScalaVersions := scala2Versions,
crossScalaVersions := allScalaVersions.filterNot(_.startsWith("0.")),
scalaJSLinkerConfig ~= (_.withModuleKind(ModuleKind.CommonJSModule))
)
val sharedJSConfigure: Project => Project =
Expand Down Expand Up @@ -208,8 +208,10 @@ lazy val munit = crossProject(JSPlatform, JVMPlatform, NativePlatform)
.jsSettings(
sharedJSSettings,
libraryDependencies ++= List(
"org.scala-js" %% "scalajs-test-interface" % scalaJSVersion,
"org.scala-js" %% "scalajs-junit-test-runtime" % scalaJSVersion
("org.scala-js" %% "scalajs-test-interface" % scalaJSVersion)
.withDottyCompat(scalaVersion.value),
("org.scala-js" %% "scalajs-junit-test-runtime" % scalaJSVersion)
.withDottyCompat(scalaVersion.value)
)
)
.jvmSettings(
Expand Down Expand Up @@ -249,7 +251,7 @@ lazy val munitScalacheck = crossProject(JSPlatform, JVMPlatform, NativePlatform)
.settings(
moduleName := "munit-scalacheck",
sharedSettings,
libraryDependencies += "org.scalacheck" %%% "scalacheck" % "1.15.0"
libraryDependencies += "org.scalacheck" %%% "scalacheck" % "1.15.1"
)
.jvmSettings(
sharedJVMSettings
Expand Down
3 changes: 2 additions & 1 deletion munit/js/src/main/scala/munit/internal/JSIO.scala
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ object JSPath extends js.Any {
object JSIO {
private[internal] val process: JSProcess =
js.Dynamic.global.process.asInstanceOf[JSProcess]
def isNode: Boolean = !js.isUndefined(process) && !js.isUndefined(process.cwd)
def isNode: Boolean =
!js.isUndefined(process) && !js.isUndefined(process.cwd())

def inNode[T](f: => T): T =
if (JSIO.isNode) f
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ class TagsFilter(
var isExcluded = false
description.getAnnotations.foreach {
case t: Tag =>
isIncluded ||= include.contains(t.value())
isExcluded ||= exclude.contains(t.value())
isIncluded ||= include.contains(t.value)
isExcluded ||= exclude.contains(t.value)
case _ =>
}
isIncluded && !isExcluded
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ abstract class JUnitFramework extends Framework {
var logAssert = false
var notLogExceptionClass = false
var useSbtLoggers = false
var trimStackTraces = defaults.trimStackTraces()
var trimStackTraces = defaults.trimStackTraces
var includeTags = Set.empty[String]
var excludeTags = Set.empty[String]
for (str <- args) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package munit.internal.junitinterface

trait Settings {
def trimStackTraces(): Boolean
def trimStackTraces: Boolean
}

object Settings {
def defaults(): Settings = new Settings {
def trimStackTraces(): Boolean = true
def trimStackTraces: Boolean = true
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package munit.internal.junitinterface

trait Tag {
def value(): String
def value: String
}
8 changes: 4 additions & 4 deletions munit/shared/src/main/scala/munit/MUnitRunner.scala
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class MUnitRunner(val cls: Class[_ <: Suite], newInstance: () => Suite)
)
}

override def getDescription: Description = {
override def getDescription(): Description = {
val description = Description.createSuiteDescription(cls)

try {
Expand All @@ -104,7 +104,7 @@ class MUnitRunner(val cls: Class[_ <: Suite], newInstance: () => Suite)
Await.result(runAsync(notifier), Duration.Inf)
}
def runAsync(notifier: RunNotifier): Future[Unit] = {
val description = getDescription
val description = getDescription()
notifier.fireTestSuiteStarted(description)
try {
runAll(notifier)
Expand Down Expand Up @@ -139,7 +139,7 @@ class MUnitRunner(val cls: Class[_ <: Suite], newInstance: () => Suite)

private def runAll(notifier: RunNotifier): Future[Unit] = {
if (PlatformCompat.isIgnoreSuite(cls)) {
val description = getDescription
val description = getDescription()
notifier.fireTestIgnored(description)
return Future.successful(())
}
Expand Down Expand Up @@ -356,7 +356,7 @@ class MUnitRunner(val cls: Class[_ <: Suite], newInstance: () => Suite)
notifier.fireTestFinished(description)
}
private def trimStackTrace(ex: Throwable): Unit = {
if (settings.trimStackTraces()) {
if (settings.trimStackTraces) {
StackTraces.trimStackTrace(ex)
}
}
Expand Down

0 comments on commit 44b0edb

Please sign in to comment.