Hi all, I’m getting the below error when trying to...
# kotest
p
Hi all, I’m getting the below error when trying to set my beforeAll function to suspend
override suspend fun beforeAll() {...
, which is because I’m trying to make it call a suspend function which waits for test data to be generated (removed company names below)
Copy code
Conflicting overloads: public open suspend fun beforeAll(): Unit defined in com..., public open fun beforeAll(): Unit defined in io.kotest.core.config.AbstractProjectConfig
Has anyone else had this problem?
e
If you just need to bridge blocking and non-blocking code, you could invoke your suspending function in
runBlocking { }
?
p
Thanks I’ll give that a try
s
Does your test class extend anything other than a spec class
p
This is basically what it looks like, just extending AbstractProjectConfig
Copy code
object MyConfig : AbstractProjectConfig() {
    override val globalAssertSoftly = true

    override fun beforeAll() {
        super.beforeAll()

        // Set up things here
    }
}
s
Ahhh you're talking about the one in project config
p
runBlocking worked perfectly, thanks for the help 🙂
s
So the beforeAll in project config is not suspend because it's been around since before coroutines existed
but I think for 5.0 we will make it suspendable
e
What's the benefit of having it suspend? Mustn't it complete before any tests starts anyway?
s
allows you to do suspend stuff without requiring run blocking
⏸️ 2
e
Gotcha :)
k
That’s a welcome change, nice.