Skip to content

Taskora API Reference / test / TestRunner

Class: TestRunner ​

Defined in: packages/taskora/dist/test/index.d.mts:18

Constructors ​

Constructor ​

new TestRunner(options?): TestRunner

Defined in: packages/taskora/dist/test/index.d.mts:25

Parameters ​

ParameterType
options?TestRunnerOptions

Returns ​

TestRunner

Properties ​

PropertyModifierTypeDefined in
appreadonlyApppackages/taskora/dist/test/index.d.mts:19

Accessors ​

jobs ​

Get Signature ​

get jobs(): object[]

Defined in: packages/taskora/dist/test/index.d.mts:62

All jobs with their current state.

Returns ​

object[]


steps ​

Get Signature ​

get steps(): object[]

Defined in: packages/taskora/dist/test/index.d.mts:69

Workflow step execution history.

Returns ​

object[]

Methods ​

advanceTime() ​

advanceTime(duration): Promise<void>

Defined in: packages/taskora/dist/test/index.d.mts:52

Advance virtual time, promote delayed jobs, and process all due work.

Parameters ​

ParameterType
durationDuration

Returns ​

Promise<void>


clear() ​

clear(): void

Defined in: packages/taskora/dist/test/index.d.mts:76

Reset all in-memory state between tests.

Returns ​

void


dispatch() ​

dispatch<TInput, TOutput>(task, data, options?): ResultHandle<TOutput>

Defined in: packages/taskora/dist/test/index.d.mts:48

Dispatch a job into the in-memory queue. The task must be registered on runner.app (via app.task(), importTask(), or from).

Type Parameters ​

Type Parameter
TInput
TOutput

Parameters ​

ParameterType
taskTask<TInput, TOutput>
dataTInput
options?DispatchOptions

Returns ​

ResultHandle<TOutput>


dispose() ​

dispose(): void

Defined in: packages/taskora/dist/test/index.d.mts:78

Restore original adapters when using from mode. Call in afterEach.

Returns ​

void


execute() ​

execute<TInput, TOutput>(task, data, options?): Promise<ExecutionResult<TOutput>>

Defined in: packages/taskora/dist/test/index.d.mts:36

Full queue pipeline: dispatch → process → auto-advance retries → return result + metadata. Auto-imports the task if not already registered on runner.app. Processes ALL tasks (including sub-tasks dispatched by the handler).

Type Parameters ​

Type Parameter
TInput
TOutput

Parameters ​

ParameterType
taskTask<TInput, TOutput>
dataTInput
options?DispatchOptions

Returns ​

Promise<ExecutionResult<TOutput>>


flush() ​

flush(task, key?): Promise<void>

Defined in: packages/taskora/dist/test/index.d.mts:60

Force-flush collect buffers for a task and process resulting jobs.

Parameters ​

ParameterType
taskTask<unknown, unknown>
key?string

Returns ​

Promise<void>


importTask() ​

importTask<TInput, TOutput>(task): Task<TInput, TOutput>

Defined in: packages/taskora/dist/test/index.d.mts:43

Import a production task into the test runner. Copies handler, config, middleware, schemas — rebinds to the memory adapter. Returns a new Task registered on runner.app. Not needed when using createTestRunner({ from: app }).

Type Parameters ​

Type Parameter
TInput
TOutput

Parameters ​

ParameterType
taskTask<TInput, TOutput>

Returns ​

Task<TInput, TOutput>


processAll() ​

processAll(): Promise<void>

Defined in: packages/taskora/dist/test/index.d.mts:56

Process all waiting jobs across all tasks until the queues are drained.

Returns ​

Promise<void>


run() ​

run<TInput, TOutput>(task, data): Promise<TOutput>

Defined in: packages/taskora/dist/test/index.d.mts:30

Execute a task handler directly with retry support. Bypasses the queue — runs the handler inline and returns the result.

Type Parameters ​

Type Parameter
TInput
TOutput

Parameters ​

ParameterType
taskTask<TInput, TOutput>
dataTInput

Returns ​

Promise<TOutput>

Released under the MIT License.