Skip to content
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
2 changes: 0 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,7 @@ lazy val plugin = (project in file("src/plugin"))
"basic" -> "dispatcher",
"basic" -> "finds-test-from-extended-config",
"basic" -> "finds-test-from-it-config",
"basic" -> "run-listener",
"basic" -> "tags",
"interop" -> "reports-missing-runtime"
)
val args = values.filterNot(exclude).map { case (x1, x2) => s"${x1}/${x2}" }
val arg = args.mkString(" ", " ", "")
Expand Down
8 changes: 4 additions & 4 deletions src/plugin/src/sbt-test/basic/run-listener/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ libraryDependencies ++= Seq(

InputKey[Unit]("tests-executed") := {
val expected = Def.spaceDelimited("<test-classes>").parsed
val testsrun = IO.readLines(target.value / "testsrun").toSet
val testsrun = IO.readLines(file("target/testsrun")).toSet
expected.foreach { test =>
if (!testsrun(test)) {
throw new RuntimeException("Expected test " + test + " to be run, but it wasn't. Tests that were run:\n" + testsrun.mkString("\n"))
Expand All @@ -15,7 +15,7 @@ InputKey[Unit]("tests-executed") := {

InputKey[Unit]("tests-not-executed") := {
val notExpected = Def.spaceDelimited("<test-classes>").parsed
val testsrun = IO.readLines(target.value / "testsrun").toSet
val testsrun = IO.readLines(file("target/testsrun")).toSet
notExpected.foreach { test =>
if (testsrun(test)) {
throw new RuntimeException("Expected test " + test + " not to be run, but it was. Tests that were run:\n" + testsrun.mkString("\n"))
Expand All @@ -24,5 +24,5 @@ InputKey[Unit]("tests-not-executed") := {
}

TaskKey[Unit]("reset-tests") := {
(target.value / "testsrun").delete()
}
file("target/testsrun").delete()
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ libraryDependencies ++= Seq(
* library is missing.
*/
TaskKey[Unit]("checkDefinedTestsThrowsException") := {
(Test / definedTests).result.value match {
case Inc(cause:Incomplete) =>
(Test / definedTests).result.value.toEither match {
case Left(cause:Incomplete) =>
val actualMessage = cause.causes.flatMap(_.causes).headOption.flatMap(_.directCause).map(_.getMessage).getOrElse("")
val expectedMessage = "Found at least one JUnit 5 test"
assert(actualMessage.startsWith(expectedMessage),
s"Expected an exception containing a message starting with `$expectedMessage` (actual: `$actualMessage`)")
Seq.empty
case Value(_:Seq[TestDefinition]) =>
case Right(_:Seq[TestDefinition]) =>
sys.error(s"Expected task `definedTests` to throw an exception due to " +
"`jupiter-interface` not being on the test-classpath.")
}
Expand Down