Skip to content

Commit 6ecf846

Browse files
committed
Merge branch 'Guidoooch-main'
2 parents ced778b + a452382 commit 6ecf846

File tree

4 files changed

+28
-17
lines changed

4 files changed

+28
-17
lines changed

build.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ name := "junit-5.10"
55

66
organization := "org.scalatestplus"
77

8-
version := "3.2.19.0"
8+
version := "3.2.19.1"
99

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

examples/gradle-example/build.gradle

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,16 @@ plugins {
44

55
repositories {
66
mavenCentral()
7+
mavenLocal()
78
}
89

910
dependencies {
10-
implementation "org.scala-lang:scala3-library_3:3.4.1"
11+
implementation "org.scala-lang:scala3-library_3:3.3.3"
1112

12-
testImplementation "org.scalatest:scalatest_3:3.2.18"
13+
testImplementation "org.scalatest:scalatest_3:3.2.19"
1314
testImplementation "org.junit.platform:junit-platform-launcher:1.10.2"
1415
testRuntimeOnly "org.junit.platform:junit-platform-engine:1.10.2"
15-
testRuntimeOnly "org.scalatestplus:junit-5-10_3:3.2.18.0"
16+
testRuntimeOnly "org.scalatestplus:junit-5-10_3:3.2.19.1"
1617
}
1718

1819
test {

examples/gradle-example/src/test/scala/co/helmethair/scalatest/example/TaggedTest.scala

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,16 @@ object TagTwo extends Tag("TagTwo")
99

1010
class TaggedTest extends AnyFlatSpec {
1111

12-
"Integration tests" can "sometimes be slow" taggedAs TagOne in {
13-
12+
"Excluded tests" should "should not run" taggedAs TagOne in {
13+
fail("This test should not run")
1414
}
1515

16-
"Unit tests" can "be fast" taggedAs TagTwo in {
16+
"Included tests" should "run" taggedAs TagTwo in {}
17+
}
18+
19+
class ExcludedTestsSuite extends AnyFlatSpec {
1720

21+
"A test suite with all tests excluded" should "should not run" taggedAs TagOne in {
22+
fail("This test should not run")
1823
}
1924
}

src/main/scala/org/scalatestplus/junit5/ScalaTestEngine.scala

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -262,11 +262,15 @@ class ScalaTestEngine extends org.junit.platform.engine.TestEngine {
262262
val reporter = new EngineExecutionListenerReporter(listener, clzDesc, engineDesc)
263263
val children = clzDesc.getChildren.asScala
264264

265-
val filter =
266-
if (children.isEmpty ||
267-
suiteToRun.testNames.size == children.size
268-
) // When testNames size is same as children size, it means all tests are selected, so no need to apply filter, this solves the issue of dynamic test names when running suite.
269-
Filter()
265+
val filter = {
266+
if (children.isEmpty)
267+
Filter(
268+
tagsToInclude = None,
269+
excludeNestedSuites = false,
270+
dynaTags = DynaTags(Map.empty, Map(suiteToRun.suiteId -> Map.empty))
271+
)
272+
if (suiteToRun.testNames.size == children.size) // When testNames size is same as children size, it means all tests are selected, so no need to apply filter, this solves the issue of dynamic test names when running suite.
273+
Filter.default
270274
else {
271275
val SelectedTag = "Selected"
272276
val SelectedSet = Set(SelectedTag)
@@ -277,12 +281,13 @@ class ScalaTestEngine extends org.junit.platform.engine.TestEngine {
277281
}.toSet
278282
val taggedTests: Map[String, Set[String]] = desiredTests.map(_ -> SelectedSet).toMap
279283
val suiteId = suiteToRun.suiteId
280-
Filter(
281-
tagsToInclude = Some(SelectedSet),
282-
excludeNestedSuites = true,
283-
dynaTags = DynaTags(Map.empty, Map(suiteId -> taggedTests))
284-
)
284+
Filter(
285+
tagsToInclude = Some(SelectedSet),
286+
excludeNestedSuites = true,
287+
dynaTags = DynaTags(Map.empty, Map(suiteId -> taggedTests))
288+
)
285289
}
290+
}
286291

287292
if (suiteToRun.isInstanceOf[ParallelTestExecution]) {
288293
val numThreads = System.getProperty("org.scalatestplus.junit5.numThreads", "0")

0 commit comments

Comments
 (0)