Skip to content

Commit

Permalink
Add code coverage reports
Browse files Browse the repository at this point in the history
  • Loading branch information
gbrail committed Jun 10, 2024
1 parent a236c26 commit 01e0a7f
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 1 deletion.
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,21 @@ You can also run the benchmarks:

./gradlew jmh

### Code Coverage

The "Jacoco" coverage is enabled by default for the main published modules as well as the special
"tests" module. Coverage is generated for each of the main projects separately and available by
running

./gradlew jacocoTestReport

To see an aggregated coverage report for everything, which is probably what you want, run

./gradlew testCodeCoverageReport

The result is in:
./tests/build/reports/jacoco/testCodeCoverageReport/html

## Releasing and publishing new version

1. Ensure all tests are passing
Expand Down
9 changes: 9 additions & 0 deletions buildSrc/src/main/groovy/rhino.library-conventions.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ plugins {
id 'com.github.spotbugs'
id 'maven-publish'
id 'checkstyle'
id 'jacoco'
}

import com.github.spotbugs.snom.Confidence
Expand Down Expand Up @@ -41,6 +42,14 @@ spotbugsMain {
}
}

jacocoTestReport {
reports {
xml.required = false
csv.required = false
html.outputLocation = layout.buildDirectory.dir('reports/jacoco')
}
}

task javadocJar(type: Jar) {
archiveClassifier = 'javadoc'
from javadoc
Expand Down
12 changes: 11 additions & 1 deletion tests/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
plugins {
id 'rhino.java-conventions'
id 'jacoco'
id 'jacoco-report-aggregation'
}

dependencies {
Expand Down Expand Up @@ -45,4 +47,12 @@ test {
if (System.getProperty('updateTest262properties') != null) {
systemProperty 'updateTest262properties', System.getProperty('updateTest262properties')
}
}
}

jacocoTestReport {
reports {
xml.required = false
csv.required = false
html.outputLocation = layout.buildDirectory.dir('reports/jacoco')
}
}

0 comments on commit 01e0a7f

Please sign in to comment.