Files
element-x-android/tests/konsist/build.gradle.kts
T
Jorge Martín ddc972a365 Run Konsist tests sequentially
It's sadly faster that way:

Every time we run a test class in parallel a new JVM is started, and the `KoScope` contents can't be shared between them.
This scope can take a few minutes to load, so having several instances of this happening at the same time is a terrible idea.
It's actually faster to run the tests sequentially, at least locally.
2026-07-29 13:28:22 +02:00

40 lines
1.6 KiB
Kotlin

/*
* Copyright (c) 2025 Element Creations Ltd.
* Copyright 2023-2025 New Vector Ltd.
*
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial.
* Please see LICENSE files in the repository root for full details.
*/
plugins {
id("io.element.android-compose-library")
}
android {
namespace = "io.element.android.tests.konsist"
}
dependencies {
val composeBom = platform(libs.androidx.compose.bom)
testImplementation(composeBom)
testImplementation(libs.androidx.compose.ui.tooling.preview)
testImplementation(libs.test.junit)
testImplementation(libs.test.konsist)
testImplementation(libs.test.truth)
testImplementation(projects.libraries.architecture)
testImplementation(projects.libraries.designsystem)
}
// Make sure Konsist tests run for 'check' tasks. This is needed because otherwise we'd have to either:
// - Add every single module as a dependency of this one.
// - Move the Konsist tests to the `app` module, but the `app` module does not need to know about Konsist.
tasks.withType<Test>().configureEach {
// Disable parallel tests: every time we run a test class in parallel a new JVM is started, and the `KoScope` contents can't be shared between them.
// This scope can take 1-2min to load, so having several instances of this happening is a terrible idea.
// It's actually faster to run the tests sequentially, at least locally.
maxParallelForks = 1
val isNotCheckTask = gradle.startParameter.taskNames.any { it.contains("check", ignoreCase = true).not() }
outputs.upToDateWhen { isNotCheckTask }
}