From 83e565372964a46f6047595dad381d0226b13281 Mon Sep 17 00:00:00 2001 From: sksamuel Date: Sat, 9 Mar 2024 20:28:37 -0600 Subject: [PATCH] Updated docs for project config to specify class except on JVM and JS #3804 --- documentation/docs/framework/project_config.md | 3 ++- .../kotlin/io/kotest/core/config/AbstractProjectConfig.kt | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/documentation/docs/framework/project_config.md b/documentation/docs/framework/project_config.md index 2cfcd655df2..3b707ae2371 100644 --- a/documentation/docs/framework/project_config.md +++ b/documentation/docs/framework/project_config.md @@ -10,7 +10,8 @@ Kotest is flexible and has many ways to configure tests, such as configuring the test classes are created. Sometimes you may want to set this at a global level and for that you need to use project-level-config. -Project level configuration can be used by creating an object or class that extends from `AbstractProjectConfig`. +Project level configuration can be used by creating a class that extends from `AbstractProjectConfig`. +Note: On the JVM and JS platforms, an object is also supported if you prefer to a class. Any configuration set at the Spec level or directly on a test will override the config specified at the project level. diff --git a/kotest-framework/kotest-framework-api/src/commonMain/kotlin/io/kotest/core/config/AbstractProjectConfig.kt b/kotest-framework/kotest-framework-api/src/commonMain/kotlin/io/kotest/core/config/AbstractProjectConfig.kt index c1f1652a075..5ff5c240852 100644 --- a/kotest-framework/kotest-framework-api/src/commonMain/kotlin/io/kotest/core/config/AbstractProjectConfig.kt +++ b/kotest-framework/kotest-framework-api/src/commonMain/kotlin/io/kotest/core/config/AbstractProjectConfig.kt @@ -21,14 +21,15 @@ import kotlin.time.Duration * Project-wide configuration. Extensions returned by an instance of this class will be applied * to all [Spec]s and [TestCase][io.kotest.core.test.TestCase]s. * - * Create an object or class that is derived from this class and place it in your source. + * Create a class that is derived from this class and place it in your source. + * Note, on the JVM and JS, this config class can also be an object. * * It will be detected at runtime and used to configure the test engine. * * For example, you could create this object and place the source in `src/main/kotlin/my/test/package`. * * ``` - * object KotestProjectConfig : AbstractProjectConfig() { + * class KotestProjectConfig : AbstractProjectConfig() { * override val failOnEmptyTestSuite = true * override val testCaseOrder = TestCaseOrder.Random * }