https://kotlinlang.org logo
Title
h

Hadi Tok

11/08/2018, 4:02 PM
I am running a unit test on a coroutine with
Dispatchers.Main
and I am getting
java.lang.IllegalStateException: Module with the Main dispatcher had failed to initialize
I can provide
Dispatchers.Main
externally or use Roboelectric but is there anything else that I can do?
p

plastiv

11/08/2018, 4:05 PM
Right now you have to switch
Main
with non-android dependent dispatcher yourself through the DI while running tests. There is an open proposal to make it possible to switch globally https://github.com/Kotlin/kotlinx.coroutines/issues/746
h

Hadi Tok

11/08/2018, 4:08 PM
yeah this would make sense