fun createTestCoroutineScope(context: CoroutineContext = EmptyCoroutineContext): TestCoroutineScope

A coroutine scope for launching test coroutines.

This is a function for aiding in migration from TestCoroutineScope to TestScope. Please see the migration guide for an instruction on how to update the code for the new API.

It ensures that all the test module machinery is properly initialized.

  • If context doesn't define a TestCoroutineScheduler for orchestrating the virtual time used for delay-skipping, a new one is created, unless either