CoverJet is lightweight Gradle plugin that uses IntelliJ Coverage engine to collect coverage data.
Also, the plugin provides infrastructure to collect coverage from GradleRunner tests(See Gradle Runner tests).
CoverJet compatibility table:
| CoverJet plugin | Gradle | min JVM | Kotlin |
|---|---|---|---|
| 0.1.+ | 8.14+ - 9.1+ | 17 | 2.1.20+ |
| 0.0.+ | 7.6.4 - 8.13+ | 17 | 2.0+ |
Kotlin
plugins {
id("io.github.gw-kit.cover-jet") version "<the-plugin-version>"
}Kotlin
coverJet {
// Default: 1.0.744
intellijCoverageVersion.set("<agent-version>")
}
./gradlew test The test coverage data in binary format will be saved by the path build/coverage/<test-task-name>.ic.
This section is useful for plugin developers who want to collect coverage data from GradleRunner tests.
Since, GradleRunner tests are executed in a separate JVM, the coverage data is not collected by default.
CoverJet plugin generates all required JVM agent properties to collect coverage data.
The only action required from plugin dev is to configure the GradleRunner in the next way:
val projectRoot: File = File("<path-to-project>")
val gradleRunner = GradleRunner.create()
.withPluginClasspath()
.withProjectDir(projectRoot)
// other configurations if needed
.apply {
// gradle testkit support
val testKitPath: String = System.getProperty("io.github.gwkit.coverjet.test-kit")
File(projectDir, "gradle.properties").appendText(
File(testKitPath).readText()
)
}Coming soon...