Controversial suggestion (but its 6.0 we can make ...
# kotest-contributors
s
Controversial suggestion (but its 6.0 we can make breaking changes) - should we replace instance per test/leaf with a new instance per root? 🧵
The hoops we have to jump through to detect that a nested test is a "leaf" and then execute it in a new spec and repeating all the parent tests seems like something we should avoid to me.
an instance per root makes much more sense, as those are known in advance and we don't need to do any runtime trickery
That's probably a bit closer to what junit does too
Benefits: • could remove TestType completely (dynamic is already gone) • Would be a step closer to aligning jvm and non-jvm • would massively simplify the spec execution code • would remove all the weird edge cases about when callbacks are invoked in extensions etc • would allow better/simpler concurrency options
l
Personally, I don't use InstancePerLeaf that much, so it wouldn't impact me a lot.
That's probably a bit closer to what junit does too
This is I think a great point to raise. I think we should get closer to JUnit without sacrificing the Kotlin Removing weird corner cases is also great for maintenability and stability of the code base. I don't have anything against it, but my opinion might not be the best for this situation
s
Still a decent amount to do, but this is what I have so far: https://github.com/kotest/kotest/pull/4626
a
I see a lot of uses of
InstancePerTest
instead of clearing mocks. Is it going to be removed for good? If yes, migration to 6.0 might take quite a lot of time, unless we have an easy way to replace
InstancePerTest
s
The tests are almost done
s
question: I use instance per leaf, what are the downsides of the new changes for me?