Tests get run multiple times when test contains when clause with enums AND using maxParallelForks #3973
Labels
bug 🐛
Issues that report a problem or error in the code.
framework 🏗️
Pertains to the core structure and components of the Kotest framework.
Kotest version: 5.8.1
This is one of the weirder bugs I've seen.
Repro here, containing a single commit on top of the
kotest-examples-multiplatform
repo main.If you run
./gradlew cleanJvmTest jvmTest
, you'll see that every test within the module is run twice. This is also visible frombuild/reports/tests/jvmTest/index.html
. IfmaxParallelForks
is set to 1, this issue does not occur.If you copy the test case in
WhenTest
, each new copy of the test case will cause all tests to be run an additional time.Based on trial and error, I narrowed this down to
when
clauses being added to the test that operate on anenum
. Looking at the compiled classes, I suspect it has something to do with this$WhenMappings
class that is generated, e.g.Each test case that uses a
when
on anenum
seems to generate a extra inner class... and my hypothesis is that Kotest's runner (or JUnit framework? or Gradle?) isn't deduping this with the outer class properly.The text was updated successfully, but these errors were encountered: