pauseDispatcher

@ExperimentalCoroutinesApi abstract suspend fun pauseDispatcher(
    block: suspend () -> Unit
): Unit

Run a block of code in a paused dispatcher.

By pausing the dispatcher any new coroutines will not execute immediately. After block executes, the dispatcher will resume auto-advancing.

This is useful when testing functions that start a coroutine. By pausing the dispatcher assertions or setup may be done between the time the coroutine is created and started.

@ExperimentalCoroutinesApi abstract fun pauseDispatcher(): Unit

Pause the dispatcher.

When paused, the dispatcher will not execute any coroutines automatically, and you must call runCurrent or advanceTimeBy, or advanceUntilIdle to execute coroutines.