kotest-core / io.kotest.core.runtime / CallingThreadExecutionContext

CallingThreadExecutionContext

object CallingThreadExecutionContext : ExecutionContext

Implementation of ExecutionContext to be used in environments which do not provide the ability to spawn threads, such as Javascript. All executions occur on the same thread as the caller. This means we cannot detect a deadlock in a test as we can on the JVM by running the test in a seperate thread.

Functions

execute

suspend fun <T> execute(f: suspend () -> T): Try<T>

executeWithTimeoutInterruption

suspend fun <T> executeWithTimeoutInterruption(timeout: Duration, f: suspend () -> T): T