Mike Kienenberger
02/19/2026, 9:40 PM--tests argument support, and tests get filtered correctly. Thanks!
Unfortunately, gradle doesn't seem to detect that jsNodeTest is executing these these tests.
> Task :jsNodeTest
FAILURE: Build failed with an exception.
* What went wrong:
No matching tests found in any candidate test task.
Requested tests:
Test pattern com.xyz.example.ExampleTest in task :jsNodeTest
For :cleanJsNodeTest :jsNodeTest --tests 'com.xyz.example.ExampleTest' (ide-generated target)
A hacky workaround is to do something like this:
tasks.named<org.jetbrains.kotlin.gradle.targets.js.testing.KotlinJsTest>("jsNodeTest") {
doFirst {
var currentClass: Class<*>? = filter.javaClass
var field: java.lang.reflect.Field? = null
// Search through the class hierarchy for the commandLineIncludeTestNames field
while (currentClass != null && field == null) {
try {
field = currentClass.getDeclaredField("commandLineIncludeTestNames")
} catch (_: NoSuchFieldException) {
currentClass = currentClass.superclass
}
}
if (field != null) {
field.isAccessible = true
val patterns = field.get(filter) as? MutableSet<*>
// Clear the commandLineIncludeTestNames so Gradle doesn't validate test execution
patterns?.clear()
println("Cleared command line test patterns to prevent Gradle validation")
}
}
}
I've tried reading through the kotest code and reading through gradle's docs on org.gradle.api.tasks.testing.TestListener.
It's unclear to me if the problem is that kotest isn't using a TestListener to report test results, whether test listener is supposed to be handled outside of kotest in jsNodeTest but isn't, whether the test names are not coming through with the package prefix (certainly a lot harder to determine in IR), or if perhaps I need to upgrade past kotlin 2.2.21.sam
02/19/2026, 10:32 PMsam
02/19/2026, 10:32 PMMike Kienenberger
02/20/2026, 3:37 PM