Skip to content

@temporal-contract/testing


@temporal-contract/testing / test-rig

test-rig ​

Functions ​

testRig() ​

ts
function testRig<TContract>(testEnv, options): Promise<{
  client: ContractClient<TContract>;
  worker: TypedWorker;
}>;

Defined in: test-rig.ts:98

Build the worker + client pair every in-process test needs, and register an onTestFinished hook that replays the history of every execution the client started.

The rig deliberately does NOT scope the task queue — callers keep calling withTaskQueue themselves. A same-workflow continue-as-new must land on the contract's static queue, because the contract is closed over inside the bundled workflow module and a test-side copy can never reach it.

consumed from sibling packages' suites via the @temporal-contract/testing/test-rig subpath; the tsconfig paths indirection hides that usage from knip.

Type Parameters ​

Type Parameter
TContract extends ContractDefinition

Parameters ​

ParameterType
testEnvTestWorkflowEnvironment
optionsRigOptions<TContract>

Returns ​

Promise<{ client: ContractClient<TContract>; worker: TypedWorker; }>

Released under the MIT License.