kotest-core / io.kotest.core.runtime

Package io.kotest.core.runtime

Types

CallingThreadExecutionContext

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.

object CallingThreadExecutionContext : ExecutionContext

ExecutionContext

Abstracts the execution of functions. To be used when we want to ensure that multiple functions are executed in the same thread, but we cannot control the threading directly in the common lib.

interface ExecutionContext

ExecutorExecutionContext

class ExecutorExecutionContext : ExecutionContext

KotestAdapter

object KotestAdapter

TestExecutionListener

interface TestExecutionListener

TestExecutor

Executes a single TestCase. Uses a TestExecutionListener to notify callers of events in the test.

class TestExecutor

Exceptions

TimeoutException

data class TimeoutException : Exception

Functions

afterAll

Invokes the after project listeners.

fun afterAll(): Try<Unit>

beforeAll

Invokes the before project listeners, and prints project config using dumpProjectConfig.

fun beforeAll(): Try<Unit>

configureRuntime

fun configureRuntime(): Unit

describe

fun describe(name: String, fn: () -> Unit): Unit

executeSpec

This is invoked in generated javascript code.

fun executeSpec(spec: Spec): Unit

executeWithTimeout

suspend fun TestCase.executeWithTimeout(context: TestContext, timeout: Duration): Unit

extensions

Returns the runtime resolved TestCaseExtensions applicable for this TestCase. Those are extensions registered on the test case's own config, those registered on the spec instance, and those registered at the project level.

fun TestCase.extensions(): List<TestCaseExtension>

invokeAfterInvocation

suspend fun TestCase.invokeAfterInvocation(k: Int): Unit

invokeAfterSpec

Notifies the user listeners that a Spec has finished. This will be invoked for every instance of a spec.

suspend fun Spec.invokeAfterSpec(): Try<Spec>

invokeAfterTest

suspend fun TestCase.invokeAfterTest(result: TestResult): Unit

invokeBeforeInvocation

suspend fun TestCase.invokeBeforeInvocation(k: Int): Unit

invokeBeforeSpec

Notifies the user listeners that a Spec is starting. This will be invoked for every instance of a spec.

suspend fun Spec.invokeBeforeSpec(): Try<Spec>

invokeBeforeTest

suspend fun TestCase.invokeBeforeTest(): Unit

it

fun it(name: String, fn: (dynamic) -> Any?): Unit

replay

suspend fun replay(times: Int, threads: Int, before: suspend (Int) -> Unit, after: suspend (Int) -> Unit, action: suspend (Int) -> Unit): Unit

setAdapter

fun setAdapter(adapter: dynamic): Unit

xdescribe

fun xdescribe(name: String, fn: () -> Unit): Unit

xit

fun xit(name: String, fn: () -> Any?): Unit