hi in kotest doc i saw that we can enable testDisp...
# kotest
g
hi in kotest doc i saw that we can enable testDispatcher using this
Copy code
class TestDispatcherTest : FunSpec() {
   init {
      coroutineTestScope = true
      test("this test uses a test dispatcher") {
      }
      test("and so does this test!") {
      }
   }
}
now when i tried this in my code there the test crashes with
Copy code
Dispatchers.Main was accessed when the platform dispatcher was absent and the test dispatcher was unset. Please make sure that Dispatchers.setMain() is called before accessing Dispatchers.Main and that Dispatchers.Main is not accessed after Dispatchers.resetMain().
This is a snippet of my test
Copy code
class EnterOtpComponentTest : FunSpec() {

    private lateinit var component: EnterOtpComponent
    private val mockOtpRepository = mockk<OtpRepository>(relaxed = true)
    private val testNumber = "1234567890"

    override val extensions: List<Extension> = listOf(
        KoinExtension(
            module = module {
                single<OtpRepository> { mockOtpRepository }
            },
        )
    )

    init {
        coroutineTestScope = true
        mockkObject(Analytics)
        beforeTest {
            clearAllMocks()
        }
        testSendOtp()
        testOnOtpEnter()
    }
is there anything i might have missed or doing wrong?
s
from what I can tell, kotest does not set the main dispatcher, which is what you're using and why it is resulting in an error you'd want to try and use a different dispatcher instead of the main one