diff --git a/kotest-framework/kotest-framework-api/src/commonMain/kotlin/io/kotest/core/internal/KotestEngineSystemProperties.kt b/kotest-framework/kotest-framework-api/src/commonMain/kotlin/io/kotest/core/internal/KotestEngineSystemProperties.kt index 5612f546286..7dd26fa64f8 100644 --- a/kotest-framework/kotest-framework-api/src/commonMain/kotlin/io/kotest/core/internal/KotestEngineSystemProperties.kt +++ b/kotest-framework/kotest-framework-api/src/commonMain/kotlin/io/kotest/core/internal/KotestEngineSystemProperties.kt @@ -63,4 +63,9 @@ object KotestEngineSystemProperties { * If set -> filter testCases by this severity level and higher, else running all */ const val severityPrefix = "kotest.framework.test.severity" + + /** + * Enable assert softly globally. + * */ + const val globalAssertSoftly = "kotest.framework.assertion.globalassertsoftly" } diff --git a/kotest-framework/kotest-framework-engine/src/jvmMain/kotlin/io/kotest/engine/config/loadConfigFromSystemProperties.kt b/kotest-framework/kotest-framework-engine/src/jvmMain/kotlin/io/kotest/engine/config/loadConfigFromSystemProperties.kt index db5e29dfcdd..64c19836c49 100644 --- a/kotest-framework/kotest-framework-engine/src/jvmMain/kotlin/io/kotest/engine/config/loadConfigFromSystemProperties.kt +++ b/kotest-framework/kotest-framework-engine/src/jvmMain/kotlin/io/kotest/engine/config/loadConfigFromSystemProperties.kt @@ -28,6 +28,9 @@ internal fun allowMultilineTestName(): Option = internal fun concurrencyMode(): Option = sysprop(KotestEngineSystemProperties.concurrencyMode).toOption().map { ConcurrencyMode.valueOf(it) } +internal fun globalAssertSoftly(): Option = + sysprop(KotestEngineSystemProperties.globalAssertSoftly).toOption().map { it.toUpperCase() == "TRUE" } + /** * Returns a [DetectedProjectConfig] which is built from system properties where supported. */ @@ -39,6 +42,7 @@ internal fun loadConfigFromSystemProperties(): DetectedProjectConfig { concurrencyMode = concurrencyMode(), timeout = timeout(), invocationTimeout = invocationTimeout(), - testNameRemoveWhitespace = allowMultilineTestName() + testNameRemoveWhitespace = allowMultilineTestName(), + globalAssertSoftly = globalAssertSoftly() ) }