diff --git a/build.gradle.kts b/build.gradle.kts index 6f2a26c..54ceda4 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -38,7 +38,7 @@ ktlint { version = "1.4.0" } -tasks.withType { +tasks.withType().configureEach { useJUnitPlatform() testLogging { events("passed", "failed", "skipped") diff --git a/src/main/kotlin/com/coditory/gradle/integration/TestAllTaskConfiguration.kt b/src/main/kotlin/com/coditory/gradle/integration/TestAllTaskConfiguration.kt index a8e6a96..4a85c3a 100644 --- a/src/main/kotlin/com/coditory/gradle/integration/TestAllTaskConfiguration.kt +++ b/src/main/kotlin/com/coditory/gradle/integration/TestAllTaskConfiguration.kt @@ -3,18 +3,20 @@ package com.coditory.gradle.integration import com.coditory.gradle.integration.IntegrationTestPlugin.Companion.INTEGRATION_TEST import com.coditory.gradle.integration.IntegrationTestPlugin.Companion.TEST_ALL_TASK_NAME import org.gradle.api.Project +import org.gradle.api.Task import org.gradle.api.tasks.testing.Test import org.gradle.language.base.plugins.LifecycleBasePlugin internal object TestAllTaskConfiguration { fun apply(project: Project, config: IntegrationTestPluginConfig) { - val testAllTask = project.tasks.create(TEST_ALL_TASK_NAME) - testAllTask.description = "Runs all test suites." - testAllTask.group = LifecycleBasePlugin.VERIFICATION_GROUP - testAllTask.enabled = config.allTestTaskEnabled - project.tasks.withType(Test::class.java).forEach { - testAllTask.dependsOn(it.name) + project.tasks.register(TEST_ALL_TASK_NAME) { testAllTask: Task -> + testAllTask.description = "Runs all test suites." + testAllTask.group = LifecycleBasePlugin.VERIFICATION_GROUP + testAllTask.enabled = config.allTestTaskEnabled + project.tasks.withType(Test::class.java).forEach { + testAllTask.dependsOn(it.name) + } + testAllTask.dependsOn(INTEGRATION_TEST) } - testAllTask.dependsOn(INTEGRATION_TEST) } } diff --git a/src/main/kotlin/com/coditory/gradle/integration/TestSuitesConfiguration.kt b/src/main/kotlin/com/coditory/gradle/integration/TestSuitesConfiguration.kt index 251ccbc..06d1dc5 100644 --- a/src/main/kotlin/com/coditory/gradle/integration/TestSuitesConfiguration.kt +++ b/src/main/kotlin/com/coditory/gradle/integration/TestSuitesConfiguration.kt @@ -70,11 +70,12 @@ internal object TestSuitesConfiguration { } private fun setupTestTask(project: Project, config: IntegrationTestPluginConfig) { - val integrationTestTask = project.tasks.create(INTEGRATION_TEST) - integrationTestTask.description = "Runs integration test suites." - integrationTestTask.group = LifecycleBasePlugin.VERIFICATION_GROUP - integrationTestTask.enabled = config.integrationTestsEnabled - integrationTestTask.dependsOn(INTEGRATION) + project.tasks.register(INTEGRATION_TEST) { integrationTestTask -> + integrationTestTask.description = "Runs integration test suites." + integrationTestTask.group = LifecycleBasePlugin.VERIFICATION_GROUP + integrationTestTask.enabled = config.integrationTestsEnabled + integrationTestTask.dependsOn(INTEGRATION) + } project.tasks.getByName(JavaBasePlugin.CHECK_TASK_NAME) .dependsOn(INTEGRATION_TEST) project.tasks.getByName(JavaBasePlugin.CHECK_TASK_NAME)