Skip to content

bug_26/dev2 #33

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

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
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
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ test-output/
_site/
.bsp/
build/
.gradle/
.gradle/
**/.metals
**/.bloop
8 changes: 8 additions & 0 deletions .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version = "3.9.5"
runner.dialect = scala213

maxColumn = 120
lineEndings = unix

# Only format files tracked by git.
project.git = true
54 changes: 31 additions & 23 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ name := "junit-5.13"

organization := "org.scalatestplus"

version := "3.2.19.0"
version := "3.2.19.1"

homepage := Some(url("https://github.com/scalatest/scalatestplus-junit"))

Expand All @@ -32,7 +32,8 @@ crossScalaVersions := List(
"2.11.12",
"2.12.20",
"2.13.16",
"3.3.5"
"3.3.6",
"3.7.1"
)

scalacOptions ++= Seq("-target:jvm-1.8")
Expand All @@ -42,7 +43,7 @@ Compile / unmanagedSourceDirectories ++= {
val sourceDir = (Compile / sourceDirectory).value
CrossVersion.partialVersion(scalaVersion.value).map {
case (0 | 3, _) => sourceDir / "scala-3"
case (n, _) => sourceDir / s"scala-$n"
case (n, _) => sourceDir / s"scala-$n"
}
}

Expand All @@ -69,24 +70,24 @@ import scala.xml.transform.{RewriteRule, RuleTransformer}
pomPostProcess := { (node: XmlNode) =>
new RuleTransformer(new RewriteRule {
override def transform(node: XmlNode): XmlNodeSeq = node match {
case e: Elem if e.label == "dependency"
&& e.child.exists(child => child.label == "scope") =>
case e: Elem
if e.label == "dependency"
&& e.child.exists(child => child.label == "scope") =>
def txt(label: String): String = "\"" + e.child.filter(_.label == label).flatMap(_.text).mkString + "\""
Comment(s""" scoped dependency ${txt("groupId")} % ${txt("artifactId")} % ${txt("version")} % ${txt("scope")} has been omitted """)
Comment(s""" scoped dependency ${txt("groupId")} % ${txt("artifactId")} % ${txt("version")} % ${txt(
"scope"
)} has been omitted """)
case _ => node
}
}).transform(node).head
}

Test / testOptions :=
Seq(
Tests.Argument(TestFrameworks.ScalaTest,
"-m", "org.scalatestplus.junit5",
))
Seq(Tests.Argument(TestFrameworks.ScalaTest, "-m", "org.scalatestplus.junit5"))

Test / fork := true

Test / javaOptions +="-Dorg.scalatestplus.junit5.ScalaTestEngine.disabled=true"
Test / javaOptions += "-Dorg.scalatestplus.junit5.ScalaTestEngine.disabled=true"

enablePlugins(SbtOsgi)

Expand All @@ -98,12 +99,12 @@ OsgiKeys.exportPackage := Seq(

OsgiKeys.importPackage := Seq(
"org.scalatest.*",
"org.scalactic.*",
"scala.*;version=\"$<range;[==,=+);$<replace;"+scalaBinaryVersion.value+";-;.>>\"",
"org.scalactic.*",
"scala.*;version=\"$<range;[==,=+);$<replace;" + scalaBinaryVersion.value + ";-;.>>\"",
"*;resolution:=optional"
)

OsgiKeys.additionalHeaders:= Map(
OsgiKeys.additionalHeaders := Map(
"Bundle-Name" -> "ScalaTestPlusJUnit5",
"Bundle-Description" -> "ScalaTest+JUnit5 is an open-source integration library between ScalaTest and JUnit 5 for Scala projects.",
"Bundle-DocURL" -> "http://www.scalatest.org/",
Expand Down Expand Up @@ -134,7 +135,12 @@ pomExtra := (
credentials += Credentials(Path.userHome / ".ivy2" / ".credentials")

// Temporary disable publishing of doc in dotty, can't get it to build.
Compile / packageDoc / publishArtifact := !scalaBinaryVersion.value.startsWith("3")
//Compile / packageDoc / publishArtifact := !scalaBinaryVersion.value.startsWith("3")
Compile / packageDoc / publishArtifact := true
Compile / packageSrc / publishArtifact := true

publishLocalConfiguration := publishLocalConfiguration.value.withOverwrite(true)
publishM2Configuration := publishM2Configuration.value.withOverwrite(true)

def docTask(docDir: File, resDir: File, projectName: String): File = {
val docLibDir = docDir / "lib"
Expand All @@ -151,8 +157,7 @@ def docTask(docDir: File, resDir: File, projectName: String): File = {
try {
writer.println(css)
writer.println(addlCss)
}
finally { writer.close }
} finally { writer.close }
}

if (projectName.contains("scalatest")) {
Expand All @@ -163,10 +168,13 @@ def docTask(docDir: File, resDir: File, projectName: String): File = {
docDir
}

Compile / doc := docTask((Compile / doc).value,
(Compile / sourceDirectory).value,
name.value)
//Compile / doc := docTask((Compile / doc).value, (Compile / sourceDirectory).value, name.value)

Compile / doc / scalacOptions := Seq("-doc-title", s"ScalaTest + JUnit5 ${version.value}",
"-sourcepath", baseDirectory.value.getAbsolutePath(),
"-doc-source-url", s"https://github.com/scalatest/releases-source/blob/main/scalatestplus-junit5/${version.value}€{FILE_PATH}.scala")
Compile / doc / scalacOptions := Seq(
"-doc-title",
s"ScalaTest + JUnit5 ${version.value}",
"-sourcepath",
baseDirectory.value.getAbsolutePath(),
"-doc-source-url",
s"https://github.com/scalatest/releases-source/blob/main/scalatestplus-junit5/${version.value}€{FILE_PATH}.scala"
)
2 changes: 1 addition & 1 deletion examples/gradle-example/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ dependencies {
testImplementation "org.scalatest:scalatest_3:3.2.19"
testImplementation "org.junit.platform:junit-platform-launcher:1.13.1"
testRuntimeOnly "org.junit.platform:junit-platform-engine:1.13.1"
testRuntimeOnly "org.scalatestplus:junit-5-13_3:3.2.19.0"
testRuntimeOnly "org.scalatestplus:junit-5-13_3:3.2.19.1"
}

test {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ class CustomListener extends TestExecutionListener {
}

override def executionFinished(testIdentifier: TestIdentifier, testExecutionResult: TestExecutionResult): Unit = {
System.err.println(s">>>>> CustomListener: execution FINISHED: ${testIdentifier.getDisplayName} with result: ${testExecutionResult.getStatus.name()}")
System.err.println(
s">>>>> CustomListener: execution FINISHED: ${testIdentifier.getDisplayName} with result: ${testExecutionResult.getStatus.name()}"
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@ import org.scalatest.funsuite.AnyFunSuiteLike

class DynamicTest extends AnyFunSuiteLike {

test(s"(won't run with gradle or intellij single run) this is dynamic value -> ${System.currentTimeMillis()}") {
}
test(s"(won't run with gradle or intellij single run) this is dynamic value -> ${System.currentTimeMillis()}") {}

test(s"(wwill run with gradle, intellij class run and intellij single run) this is test with static name") {
}
test(s"(wwill run with gradle, intellij class run and intellij single run) this is test with static name") {}

}
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,13 @@ import org.scalatest.matchers.should.Matchers
@co.helmethair.scalatest.tags.Include
class IncludeWithScalaTag extends AnyFunSpec with Matchers {
describe("test one") {
it("assert one") {

}
it("assert two") {

}
it("assert one") {}
it("assert two") {}
}

describe("test two") {
it("assert one") {

}

it("assert two") {
it("assert one") {}

}
it("assert two") {}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package co.helmethair.scalatest.example

import org.scalatest.Suite
import org.scalatest.funspec.AnyFunSpec

object OuterSuite {

class Inner extends AnyFunSpec {
it("a") {}
}

object I1 extends Inner
}
class OuterSuite extends AnyFunSpec {

val i2 = new OuterSuite.Inner {
override def suiteName: String = "i2"
}

override def nestedSuites: IndexedSeq[Suite] = {

val i3 = new OuterSuite.Inner {
override def suiteName: String = "i3"
}

IndexedSeq(
OuterSuite.I1, // object
i2, // member
i3, // local instance
new OuterSuite.Inner() {
override def suiteName: String = "i4"
} // ad-hoc
)
}

it("b") {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,13 @@ import org.scalatest.matchers.should.Matchers
@co.helmethair.scalatest.tags.Skip
class SkipWithScalaTag extends AnyFunSpec with Matchers {
describe("test one") {
it("assert one") {

}
it("assert two") {

}
it("assert one") {}
it("assert two") {}
}

describe("test two") {
it("assert one") {

}
it("assert two") {

}
it("assert one") {}
it("assert two") {}

}
}
2 changes: 1 addition & 1 deletion examples/gradle-kotlin-dsl-example/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ dependencies {
testImplementation("org.scalatest:scalatest_3:3.2.19")
testRuntimeOnly("org.junit.platform:junit-platform-engine:1.13.1")
testRuntimeOnly("org.junit.platform:junit-platform-launcher:1.13.1")
testRuntimeOnly("org.scalatestplus:junit-5-13_3:3.2.19.0")
testRuntimeOnly("org.scalatestplus:junit-5-13_3:3.2.19.1")
}

tasks {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@ import org.scalatest.funsuite.AnyFunSuiteLike

class DynamicTest extends AnyFunSuiteLike {

test(s"(won't run with gradle or intellij single run) this is dynamic value -> ${System.currentTimeMillis()}") {
}
test(s"(won't run with gradle or intellij single run) this is dynamic value -> ${System.currentTimeMillis()}") {}

test(s"(wwill run with gradle, intellij class run and intellij single run) this is test with static name") {
}
test(s"(wwill run with gradle, intellij class run and intellij single run) this is test with static name") {}

}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ class CustomListener extends TestExecutionListener {
}

override def executionFinished(testIdentifier: TestIdentifier, testExecutionResult: TestExecutionResult): Unit = {
System.err.println(s">>>>> CustomListener: execution FINISHED: ${testIdentifier.getDisplayName} with result: ${testExecutionResult.getStatus.name()}")
System.err.println(
s">>>>> CustomListener: execution FINISHED: ${testIdentifier.getDisplayName} with result: ${testExecutionResult.getStatus.name()}"
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@ import org.scalatest.funsuite.AnyFunSuiteLike

class DynamicTest extends AnyFunSuiteLike {

test(s"(won't run with gradle or intellij single run) this is dynamic value -> ${System.currentTimeMillis()}") {
}
test(s"(won't run with gradle or intellij single run) this is dynamic value -> ${System.currentTimeMillis()}") {}

test(s"(wwill run with gradle, intellij class run and intellij single run) this is test with static name") {
}
test(s"(wwill run with gradle, intellij class run and intellij single run) this is test with static name") {}

}
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.5.8
sbt.version=1.11.2
8 changes: 8 additions & 0 deletions project/metals.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// format: off
// DO NOT EDIT! This file is auto-generated.

// This file enables sbt-bloop to create bloop config files.

addSbtPlugin("ch.epfl.scala" % "sbt-bloop" % "2.0.9")

// format: on
Loading