From 8486e12c9d37ea981df3631f59a4bc45e4e7e492 Mon Sep 17 00:00:00 2001 From: sksamuel Date: Sun, 31 Jan 2021 09:48:49 -0600 Subject: [PATCH] Fixed script context block --- .../src/commonMain/kotlin/io/kotest/core/script/styles.kt | 2 +- .../kotlin/io/kotest/framework/discovery/Discovery.kt | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/kotest-framework/kotest-framework-api/src/commonMain/kotlin/io/kotest/core/script/styles.kt b/kotest-framework/kotest-framework-api/src/commonMain/kotlin/io/kotest/core/script/styles.kt index cc572f251c7..eed47f54359 100644 --- a/kotest-framework/kotest-framework-api/src/commonMain/kotlin/io/kotest/core/script/styles.kt +++ b/kotest-framework/kotest-framework-api/src/commonMain/kotlin/io/kotest/core/script/styles.kt @@ -20,7 +20,7 @@ fun test(name: String, test: suspend TestContext.() -> Unit) { fun context(name: String, test: suspend ContextScope.() -> Unit) { val testName = createTestName(name) val description = ScriptSpec().description().append(testName, TestType.Container) - ScriptRuntime.registerRootTest(testName, false, TestType.Test) { ContextScope(description, it).test() } + ScriptRuntime.registerRootTest(testName, false, TestType.Container) { ContextScope(description, it).test() } } class ContextScope( diff --git a/kotest-framework/kotest-framework-discovery/src/jvmMain/kotlin/io/kotest/framework/discovery/Discovery.kt b/kotest-framework/kotest-framework-discovery/src/jvmMain/kotlin/io/kotest/framework/discovery/Discovery.kt index 2dac3199c0c..f91674e11a0 100644 --- a/kotest-framework/kotest-framework-discovery/src/jvmMain/kotlin/io/kotest/framework/discovery/Discovery.kt +++ b/kotest-framework/kotest-framework-discovery/src/jvmMain/kotlin/io/kotest/framework/discovery/Discovery.kt @@ -113,9 +113,11 @@ class Discovery(private val discoveryExtensions: List = empt log("After discovery extensions there are ${filtered.size} spec classes") + val scriptsEnabled = System.getProperty(KotestEngineSystemProperties.scriptsEnabled) == "true" || + System.getenv(KotestEngineSystemProperties.scriptsEnabled) == "true" + val scripts = when { - System.getProperty(KotestEngineSystemProperties.scriptsEnabled) == "true" -> discoverScripts() - System.getenv(KotestEngineSystemProperties.scriptsEnabled) == "true" -> discoverScripts() + scriptsEnabled -> discoverScripts() else -> emptyList() }