Skip to content

Instantly share code, notes, and snippets.

@cdsap
Created September 13, 2018 10:03
Show Gist options
  • Save cdsap/e64a05e278be66d1a349970e9c2d1764 to your computer and use it in GitHub Desktop.
Save cdsap/e64a05e278be66d1a349970e9c2d1764 to your computer and use it in GitHub Desktop.
Spek + Kts + Jacoc
val jacocoTestResultTaskName = "jacocoJunit5TestReport"
val junitPlatformTest: JavaExec by tasks
jacoco {
toolVersion = "0.8.2"
applyTo(junitPlatformTest)
}
task<JacocoReport>(jacocoTestResultTaskName) {
group = LifecycleBasePlugin.VERIFICATION_GROUP
description = "Generates code coverage report for the ${junitPlatformTest.name} task."
executionData(junitPlatformTest)
dependsOn(junitPlatformTest)
// sourceSets(sourceSets["main"])
sourceDirectories = files("src/main/kotlin")
classDirectories = files("build/kotlin/main")
reports {
html.isEnabled = true
xml.isEnabled = true
csv.isEnabled = true
html.destination = File("$buildDir/reports/")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment