Skip to content

Commit 5190dc0

Browse files
committed
Fix test coverage for :junit-jupiter-params
Prior to this commit the coverage for `junit-jupiter-params` was missing from the aggregated JaCoCo report because the tests were executed using different class files than those used by downstream projects that use `@ParameterizedTests`. The classes are different because we relocate classes using the shadow plugin which modifies the bytecode. The code in the buildscript that attempted to replace the classes directory with the shadowed jar file for the project's `test` task was broken since the migration to Kotlin DSL in 82eb832. Note to self: `classpath.minus(files)` does not modify `classpath` but returns a new one.
1 parent b762d8f commit 5190dc0

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

junit-jupiter-params/junit-jupiter-params.gradle.kts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ tasks {
3030
onlyIf {
3131
(rootProject.extra["generateManifest"] as Boolean || !archivePath.exists())
3232
}
33-
classifier = ""
33+
archiveClassifier.set("")
3434
configurations = listOf(project.configurations["shadowed"])
3535
exclude("META-INF/maven/**")
3636
relocate("com.univocity", "org.junit.jupiter.params.shadow.com.univocity")
@@ -39,12 +39,10 @@ tasks {
3939
into("META-INF")
4040
}
4141
}
42-
afterEvaluate {
43-
test {
44-
classpath.minus(sourceSets["main"].output)
45-
classpath.plus(files(shadowJar.get().archivePath))
46-
dependsOn(shadowJar)
47-
}
42+
test {
43+
// in order to run the test against the shadowJar
44+
classpath = classpath - sourceSets.main.get().output + files(shadowJar.get().archiveFile)
45+
dependsOn(shadowJar)
4846
}
4947
jar {
5048
enabled = false

0 commit comments

Comments
 (0)