https://kotlinlang.org logo
#kotest-contributors
Title
# kotest-contributors
s

simon.vergauwen

09/27/2023, 7:56 AM
s

sam

10/01/2023, 7:07 PM
I'm reluctant to add new specs since we already have 10, and probably 3/4 too many. Could this be added to existing specs without breaking any users code?
s

simon.vergauwen

10/01/2023, 7:08 PM
I've asked before about
suspend
constructors 😜 I'm not entirely sure where it landed, I think it can be added without breaking binary. Not 100% on semantics
s

sam

10/01/2023, 7:08 PM
I remember the discussion, it was because you want suspendable extensions
s

simon.vergauwen

10/01/2023, 7:09 PM
There might be a slight change in order of initialisation.. 🤔 Yes, exactly
It's still about that 😂
s

sam

10/01/2023, 7:09 PM
I remember we looked into it in quite some depth
s

simon.vergauwen

10/01/2023, 7:09 PM
Either that, or I think I'm going to end up just going
runBlocking
route..
s

sam

10/01/2023, 7:09 PM
It might not be the end of the world to make SuspendFreeSpec or something ?
So its clear its the same thing, just with a suspendable body
Make a new version of each one, with the prefix Suspend
s

simon.vergauwen

10/01/2023, 7:11 PM
I'm still curious if we cannot fix it without breaking semantics, and binary. I vaguely remember you mentioned you might consider it across a major version.. I need to dig up the conversation
s

sam

10/01/2023, 7:11 PM
Yeah I would consider it for 6.0
My goal is that 6.0 lines up with when compiler plugins go stable, so we can build on them properly to allow you to run a single test in intellij for js and native. But right now they are breaking things too quickly to rely on compiler plugins anymore than we do.
I wonder if we could just change FunSpec (for example) to this:
Copy code
abstract class FunSpec(body: suspend FunSpec.() -> Unit = {}) : DslDrivenSpec(), FunSpecRootScope {
   init {
      runBlocking { body() }
   }
}
I cannot remember why we said this would change semantics
s

simon.vergauwen

10/01/2023, 7:18 PM
I think I mentioned something to avoid
runBlocking
, but I don't know how much it matters in regard to how everything is initialised.
Copy code
abstract class FunSpec(body: suspend FunSpec.() -> Unit = {}) : DslDrivenSpec(), FunSpecRootScope {
}
Where it's created:
Copy code
FunSpec().apply(body)
s

sam

10/01/2023, 7:19 PM
ah runBlocking doesn't exist on JS of course
I think the issue was that in JS we don't have a promise at the time the instance is created.
Was the other problem that
FunSpec().apply(body)
runs the body after subclass inits, and right now the superclass init gets priority.
s

simon.vergauwen

10/01/2023, 7:46 PM
Aha, yes that was the problem indeed