Remove unused JUnitMode.Mix mode
It's not used by now, and there's are known problems with it check KTI-712. If transition to JUnit5 is needed, creating another module might be a better option.
This commit is contained in:
@@ -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$")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user