From 96aa348ca1ffa381f12b4ba7c7f11847693b3b3a Mon Sep 17 00:00:00 2001 From: Roman <4833306+Filter94@users.noreply.github.com> Date: Wed, 18 Dec 2024 14:10:23 +0100 Subject: [PATCH 1/2] Fixed jacoco coverage for integration tests --- build.gradle | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/build.gradle b/build.gradle index 46307076e..1c224fd15 100644 --- a/build.gradle +++ b/build.gradle @@ -56,16 +56,15 @@ allprojects { jacoco { toolVersion = '0.8.11' - if (project.tasks.findByName('integrationTest')) { - applyTo integrationTest - } - if (project.tasks.findByName('acceptanceTest')) { - applyTo acceptanceTest - } } - jacocoTestReport { - dependsOn test + gradle.projectsEvaluated { + project.tasks.jacocoTestReport { + if (project.tasks.findByName('integrationTest')) { + executionData(tasks.named("integrationTest").get()) + sourceSets(sourceSets["integrationTest"]) + } + } } tasks.withType(Test).configureEach { From 389e03e056964e94ba1a465fb156e10d80d41b2c Mon Sep 17 00:00:00 2001 From: Roman <4833306+Filter94@users.noreply.github.com> Date: Wed, 18 Dec 2024 14:27:00 +0100 Subject: [PATCH 2/2] Slightly simplified the fix --- build.gradle | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/build.gradle b/build.gradle index 1c224fd15..386f5390b 100644 --- a/build.gradle +++ b/build.gradle @@ -58,15 +58,6 @@ allprojects { toolVersion = '0.8.11' } - gradle.projectsEvaluated { - project.tasks.jacocoTestReport { - if (project.tasks.findByName('integrationTest')) { - executionData(tasks.named("integrationTest").get()) - sourceSets(sourceSets["integrationTest"]) - } - } - } - tasks.withType(Test).configureEach { testLogging { events = [ @@ -115,6 +106,13 @@ allprojects { } } } + + project.tasks.jacocoTestReport { + if (project.tasks.findByName('integrationTest')) { + executionData(tasks.named("integrationTest").get()) + sourceSets(sourceSets["integrationTest"]) + } + } } }