subprojects { module -> plugins.withType(JavaPlugin).whenPluginAdded { module.test { useJUnitPlatform() testLogging { events 'started', 'passed', 'skipped', 'failed' exceptionFormat "full" showStandardStreams true } } module.tasks.configureEach { task -> if (task.taskIdentity.type.toString() == "class org.jetbrains.kotlin.gradle.tasks.KotlinCompile") { task.kotlinOptions { freeCompilerArgs += "-opt-in=kotlin.RequiresOptIn" } } } } plugins.withId("com.android.application") { module.android.testOptions.unitTests.all { useJUnitPlatform() testLogging { events 'started', 'passed', 'skipped', 'failed' exceptionFormat "full" showStandardStreams true } } module.android.testOptions { unitTests { includeAndroidResources = true } } module.tasks.configureEach { task -> if (task.taskIdentity.type.toString() == "class org.jetbrains.kotlin.gradle.tasks.KotlinCompile") { task.kotlinOptions { freeCompilerArgs += "-opt-in=kotlin.RequiresOptIn" } } } } plugins.withId("com.android.library") { module.android.testOptions.unitTests.all { useJUnitPlatform() testLogging { events 'started', 'passed', 'skipped', 'failed' exceptionFormat "full" showStandardStreams true } } module.android.testOptions { unitTests { includeAndroidResources = true } } module.tasks.configureEach { task -> if (task.taskIdentity.type.toString() == "class org.jetbrains.kotlin.gradle.tasks.KotlinCompile") { task.kotlinOptions { freeCompilerArgs += "-opt-in=kotlin.RequiresOptIn" } } } } } task jvmTests(dependsOn: ["app:testDebugUnitTest", "core:test", "network:test"]) { group = 'Tests' description = 'Run all JVM tests' } task robolectricTests(type: Exec) { group = 'Tests' description = 'Run all Robolectric tests based on the Instrumented naming convention' // todo is there a better way? commandLine 'sh', './gradlew', 'testDebugUnitTest', '--tests', 'org.fnives.test.*InstrumentedTest' } task androidTests(dependsOn: ["app:connectedDebugAndroidTest"]) { group = 'Tests' description = 'Run Android tests' }