Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add code coverage reports #1484

Merged
merged 1 commit into from
Jun 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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')
}
}
Loading