runCurrent

Runs all enqueued tasks at this moment in the virtual time.

Example

test("Execute task") {
launchInBackground {
delay(1000)
println("Hello world!")
}

launchInBackground {
delay(2000)
println("Will never be printed")
}

time.advanceByMillis(1000)
time.runCurrent() // prints "Hello world!"
}

Stability warning

The KotlinX.Coroutines team is considering removing this functionality. Learn more in #3919.