diff --git a/buildSrc/src/main/kotlin/tasks.kt b/buildSrc/src/main/kotlin/tasks.kt index 3c8846cbd85..665be7240a1 100644 --- a/buildSrc/src/main/kotlin/tasks.kt +++ b/buildSrc/src/main/kotlin/tasks.kt @@ -88,8 +88,9 @@ fun Task.dependsOnKotlinGradlePluginPublish() { } } +// Mixing JUnit4 and Junit5 in one module proved to be problematic, consider using separate modules instead enum class JUnitMode { - JUnit4, JUnit5, Mix + JUnit4, JUnit5 } /** @@ -142,19 +143,6 @@ fun Project.projectTest( } } - val parentNames = if (jUnitMode != JUnitMode.JUnit4) { - /* - * If we run test from inner test class with junit 5 we need - * to include all containing classes of our class - */ - val nestedNames = classFileNameWithoutExtension.split("$") - mutableListOf(nestedNames.first()).also { - for (s in nestedNames.subList(1, nestedNames.size)) { - it += "${it.last()}\$$s" - } - } - } else emptyList() - include { treeElement -> val path = treeElement.path if (treeElement.isDirectory) { @@ -162,11 +150,7 @@ fun Project.projectTest( } else { if (path == classFileName) return@include true if (!path.endsWith(".class")) return@include false - when (jUnitMode) { - JUnitMode.JUnit4 -> path.startsWith("$classFileNameWithoutExtension$") - JUnitMode.Mix -> parentNames.any { path.startsWith(it) } || path.startsWith("$classFileNameWithoutExtension$") - else -> error("JUnit5 should not be reachable because of early exit") - } + path.startsWith("$classFileNameWithoutExtension$") } } }