You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Otherwise, Android users should inject main dispatcher into their classes to use Unconfined in tests. This is pretty ugly, especially when Dispatchers.Main is already here.
Proposed solution:
Introduce module kotlinx-coroutines-core-test which overrides Main dispatcher and API to inject any dispatcher as Main.
So users can use launch(Dispatchers.Main) and in tests all they need is to add a dependency to kotlinx-coroutines-core-test and use MainDispatcherInjector.inject(dispatcher: CoroutineDispatcher).
The text was updated successfully, but these errors were encountered:
I think providing a separate module 'kotlinx-coroutines-core-test'' is really important, to provide Coroutines users a dedicated module with some useful testing tools such as TestBase or TestCoroutineContext (this last one provides useful delay testing features, but will need some changes, also it shouldn't be in 'kotlinx-coroutines-core').
Otherwise, Android users should inject main dispatcher into their classes to use
Unconfined
in tests. This is pretty ugly, especially whenDispatchers.Main
is already here.Proposed solution:
Introduce module
kotlinx-coroutines-core-test
which overridesMain
dispatcher and API to inject any dispatcher asMain
.So users can use
launch(Dispatchers.Main)
and in tests all they need is to add a dependency tokotlinx-coroutines-core-test
and useMainDispatcherInjector.inject(dispatcher: CoroutineDispatcher)
.The text was updated successfully, but these errors were encountered: