kotest-core / io.kotest.core.runtime

Package io.kotest.core.runtime

Types

CallingThreadExecutionContext

Implementation of TimeoutExecutionContext 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 : TimeoutExecutionContext

ExecutorExecutionContext

object ExecutorExecutionContext : TimeoutExecutionContext

KotestAdapter

Kotest adapter for kotlin js test support.

object KotestAdapter

TestExecutionListener

interface TestExecutionListener

TestExecutor

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

class TestExecutor

TimeoutExecutionContext

Allows for the execution of a function with a timeout to wake blocked threads.

interface TimeoutExecutionContext

Exceptions

AfterProjectListenerException

class AfterProjectListenerException : RuntimeException

BeforeBeforeListenerException

class BeforeBeforeListenerException : RuntimeException

TimeoutException

data class TimeoutException : Exception

Extensions for External Classes

kotlin.collections.List

Functions

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

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): Try<TestCase>

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

Invokes the beforeTest callbacks for this test, taking the listeners from those present at the spec level and the project level.

suspend fun TestCase.invokeBeforeTest(): Try<TestCase>

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