Hello people. I’m struggling to find the right way...
# kotest
d
Hello people. I’m struggling to find the right way to use `CoroutinesScope`s in Kotest. I’m refactoring a test where I need a scope for my SUT, and before I had this:
Copy code
private val appScope = TestScope()
private val sut = Sut(appScope)

@Test
fun `some test`() = appScope.runTest { ... }
Now, with Kotest, I did this:
Copy code
class MyTest : BehaviorSpec({

    Given("abc") {
        val sut = Sut(testScope)
It worked, till I needed to call
advanceUntilIdle()
(after this code) so, to achieve that, I had to add
coroutineTestScope = true
and it became
Copy code
class MyTest : BehaviorSpec({
    coroutineTestScope = true

    Given("abc") {
        val sut = Sut(testScope)
But this doesn’t seem to work correctly, as the Flow internal to my SUT never emits. I’ll drop my SUT in the 🧵
Untitled.cpp