solonovamax
09/25/2025, 7:17 PMStableIdents.getStableIdentifier(Any?) be re-exposed so that it can be used?
I was using it for the kotlin/js platform because I could not use withData(), as it would result in an error saying "Nested tests are not supported". my workaround for this was to instead use withClue() on the kotlin/js platform, doing this:
actual fun FunSpecRootScope.testPrecomputed(
context: String,
precomputed: List<FuzzyTestData>,
resultFunction: (String, String) -> Double,
) {
context(context) {
precomputed.forEach {
withClue({ getStableIdentifier(it) }) {
resultFunction(it.first, it.second) shouldBe (it.result plusOrMinus DEFAULT_TOLERANCE)
}
}
}
}
in kotest 6.0.0, this would instead be changed to use StableIdents.getStableIdentifier(it), however this does not work because StableIdents is internal.
I was told previously that nested tests would be present in 6.0, however they don't seem to be.Alfonso Ristorato
09/28/2025, 10:12 AMwithData generic, I went ahead and raised a PR on how I would attempt this. It's by no means supposed to be accepted, especially if the team was already working on this, but in case it helps with inspiration, or is considered good enough to merge, here it is š https://github.com/kotest/kotest/pull/5113Gautam Shorewala
09/30/2025, 1:03 PMclass TestDispatcherTest : FunSpec() {
init {
coroutineTestScope = true
test("this test uses a test dispatcher") {
}
test("and so does this test!") {
}
}
}
now when i tried this in my code there the test crashes with
Dispatchers.Main was accessed when the platform dispatcher was absent and the test dispatcher was unset. Please make sure that Dispatchers.setMain() is called before accessing Dispatchers.Main and that Dispatchers.Main is not accessed after Dispatchers.resetMain().
This is a snippet of my test
class EnterOtpComponentTest : FunSpec() {
private lateinit var component: EnterOtpComponent
private val mockOtpRepository = mockk<OtpRepository>(relaxed = true)
private val testNumber = "1234567890"
override val extensions: List<Extension> = listOf(
KoinExtension(
module = module {
single<OtpRepository> { mockOtpRepository }
},
)
)
init {
coroutineTestScope = true
mockkObject(Analytics)
beforeTest {
clearAllMocks()
}
testSendOtp()
testOnOtpEnter()
}
is there anything i might have missed or doing wrong?Alfonso Ristorato
10/07/2025, 8:57 PMstelios
10/08/2025, 3:31 PMBehaviorSpec. You select a Then, you type the shortcut and then all other Thenās are transformed to xThen.
My question is can we publish it in the marketplace? In that case, our we allowed to use the term Kotest something like Focus test for Kotest or is it trademarked?Giorgio Vespucci
10/10/2025, 1:56 PMGeardaddie
10/13/2025, 6:33 PMgradle kotest successfully I canāt run gradle build without it failing because it canāt find any tests. Iām sure Iāve got something configured wrong in Gradle, but I havenāt been able to find an example build script.
kotest.io
Setup | Kotest
The Kotest test framework is supported on JVM, Javascript and Native.sam
10/15/2025, 5:19 AMsam
10/15/2025, 5:19 AMEmre
10/19/2025, 10:49 PMThe plugin doesn't register an error report submitter extension, so neither the "Report Exception" button nor the description area are enabled.https://youtrack.jetbrains.com/issue/IJPL-213335 Have you received any reports directly from the IDE lately? This is with 6.0.101-2025.2
Dave
10/22/2025, 12:06 PMBartek Milken
10/22/2025, 1:06 PMIsolationMode.InstancePerLeaf?Olaf Gottschalk
10/23/2025, 8:18 AMRob Elliot
10/24/2025, 10:18 AMsatisfy matcher should already be in the assertions library, or else there's a better pattern to be used...J
11/05/2025, 9:57 PMLukasz Kalnik
11/07/2025, 1:58 PMio.kotest.coroutines is not available anymore in 6.0. Where did it get migrated?Lukasz Kalnik
11/07/2025, 2:30 PMlistener() inside the Spec replaced with?Lukasz Kalnik
11/11/2025, 1:52 PMInstancePerLeaf as an extension/listener. Do you have any hints how I could go about it? More details in š§µLukasz Kalnik
11/11/2025, 2:53 PMEmre
11/11/2025, 5:16 PMkotest_filter_specs is not working for me. For example, when I run
kotest_filter_specs='io.kotest.examples.jvm.SsnTest' gradle kotest
in https://github.com/kotest/kotest-examples it runs them all. Did I make a mistake?Richard Schielek
11/12/2025, 3:30 PMInstancePerLeaf is gone, I found myself restoring a fresh state before each leaf. Wouldn't it be nice to have something similar to the following? Does kotest maybe already have something like this? Or should all before* functions maybe return delegates?
fun <T> ContainerScope.runningBeforeAny(initializer: () -> T): ReadOnlyProperty<Any?, T> {
var value: T? = null
beforeAny {
value = initializer()
}
@Suppress("UNCHECKED_CAST")
return ReadOnlyProperty { _, _ -> value as T }
}
object Spec : FreeSpec({
"Given an empty list of numbers" - {
val numbers by runningBeforeAny { mutableListOf<Int>() }
"when adding one" - {
beforeAny { numbers.add(1) }
"the sum should be one" {
numbers.sum() shouldBe 1
}
"the size should be one" {
numbers shouldHaveSize 1
}
"when adding another one" - {
beforeAny { numbers.add(1) }
"the sum should be two" {
numbers.sum() shouldBe 2
}
"the size should be two" {
numbers shouldHaveSize 2
}
}
}
"when leaving empty" - {
"the sum should be 0" {
numbers.sum() shouldBe 0
}
}
}
})koufa
11/13/2025, 4:19 PMSpecExecutionOrderExtension . I am logging the return value of my override fun sort(specs: List<SpecRef>): List<SpecRef> but the specs executed are in another random order. Do I have to take care of something?koufa
11/14/2025, 1:10 PMCLOVIS
11/15/2025, 10:51 AM> Task :gradle:templates:template-app:jsBrowserTest FAILED
java.lang.IllegalStateException: :gradle:templates:template-app:jsBrowserTest exited with errors (exit code: 1)
>> Kotest
- To infinity and beyond! (with tests)
- Test plan has 1 specs
1. HelloWorldKotestTest
>> All tests passed
Specs: 1 passed, 0 failed, 1 total
Tests: 0 passed, 0 failed, 0 ignored, 0 totalingwX64
Time: 0s
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':gradle:templates:template-app:jsBrowserTest'.
> There are test sources present and no filters are applied, but the test task did not discover any tests to execute. This is likely due to a misconfiguration. Please check your test configuration. If this is not a misconfiguration, this error can be disabled by setting the 'failOnNoDiscoveredTests' property to false.
Kotest clearly finds the test, but I guess it doesn't report it correctly to Gradle?eygraber
11/18/2025, 6:20 AMmingw_x64.
Gradle doesn't seem to be able to find the artifact for it, even though it exists.sam
11/30/2025, 10:18 PMsam
12/01/2025, 6:58 AMSebastian Schuberth
12/01/2025, 10:43 AMjava.lang.IllegalStateException: Could not find a valid Docker environment. Please see logs and check configuration. Any hints how to fix this?Jakob Heher
12/02/2025, 11:30 AMEmre
12/04/2025, 3:08 PM