Skip to main content

Interface: TestEnvironmentOptions

Properties​

activities?​

optional activities?: readonly ActivityImplementation<never, unknown>[]

User-activity implementations (implementActivity, defineActivity, dynamicActivity).


activityInterceptors?​

optional activityInterceptors?: readonly ActivityInboundInterceptor[]

Activity inbound interceptors around every user activity, first outermost.


connections?​

optional connections?: Readonly<Record<string, Record<string, Json>>>

Connections ActivityContext.connection(name) returns.


enabled?​

optional enabled?: CommandGate

Command set the environment accepts: a feature set or a release level; default parity.


failOnUnfinishedHandlers?​

optional failOnUnfinishedHandlers?: boolean

Turn the drain warning (a workflow that finishes while a signal handler with policy WARN_AND_ABANDON still runs, 11 §2.18) into a failure of result() (UnfinishedHandlersError). Default true.


historyRelease?​

optional historyRelease?: number

The runtime release whose history fields the environment writes (default RUNTIME_RELEASE). Release 1 omits the R2 start fields that the core service never wrote (lastCompletionResult on a continue-as-new), so R1 conformance histories record unchanged.


interceptors?​

optional interceptors?: WorkflowInterceptorsFactory | MarkedInterceptorsFactory

Workflow interceptors, as a bundle would export them as interceptors (in-process tasks only).


sinks?​

optional sinks?: Readonly<Record<string, Readonly<Record<string, (...args) => void>>>>

Sink implementations called with each task's sink calls after the task completes.


startTime?​

optional startTime?: string | number | Date

Start of the fake clock. Default 2026-01-01T00:00:00.000Z.


taskExecutor?​

optional taskExecutor?: (request) => WorkflowTaskResult | Promise<WorkflowTaskResult>

Run workflow tasks somewhere else than in this process, for example in an isolate over a built bundle (runWorkflowTaskInVm, the QuickJS runner). Start runs by export name then.

Parameters​

request​

WorkflowTaskRequest

Returns​

WorkflowTaskResult | Promise<WorkflowTaskResult>


timeSkipping?​

optional timeSkipping?: boolean

Advance the clock to the next timer whenever every run is idle (default true).


workflowKeys?​

optional workflowKeys?: Readonly<Record<string, string>>

Workflow keys of tier-2 functions (key -> export name), for ctx.child('<key>') with a task executor.


workflows?​

optional workflows?: Readonly<Record<string, DurableWorkflow<never, unknown>>>

Tier-2 functions by export name, for ctx.child(fn) and by-name starts.


workspaceId?​

optional workspaceId?: string

Workspace id written into run info.