@temporal-contract/testing / workflow-bundle
workflow-bundle
Functions
bundleFor()
function bundleFor(workflowsPath): Promise<WorkflowBundleWithSourceMap>;Defined in: workflow-bundle.ts:30
Bundle workflowsPath once per test file and reuse it thereafter. Pass the result straight to TypedWorker.create({ workflowBundle }).
Parameters
| Parameter | Type |
|---|---|
workflowsPath | string |
Returns
Promise<WorkflowBundleWithSourceMap>
fixturePath()
function fixturePath(callerUrl, filename): string;Defined in: workflow-bundle.ts:80
Resolve a sibling fixture file's path — e.g. a *.workflows.ts module next to a spec file, passed to bundleFor or a workflowsPath option. Was copy-pasted verbatim (as workflowPath, or fixturePath in one file) into every *.inprocess.spec.ts file plus a couple of Docker-tier specs before being lifted here.
callerUrl MUST be the caller's own import.meta.url, not this module's — the whole point is resolving relative to where the caller lives, and import.meta.url is only meaningful read from the module that owns it. That's also why this derives the extension from callerUrl rather than hard-coding .ts/.js: it lets the same call resolve correctly whether the caller is running from .ts source (vitest) or built .js output.
Parameters
| Parameter | Type |
|---|---|
callerUrl | string |
filename | string |
Returns
string
nextTaskQueueId()
function nextTaskQueueId(prefix): string;Defined in: workflow-bundle.ts:61
Monotonic task-queue id. Deliberately a counter rather than Math.random() / Date.now() so a failing run is reproducible.
Parameters
| Parameter | Type |
|---|---|
prefix | string |
Returns
string
withTaskQueue()
function withTaskQueue<TContract>(contract, id): TContract;Defined in: workflow-bundle.ts:48
TypedWorker.create hard-codes taskQueue: contract.taskQueue and its options type omits taskQueue entirely, so a per-test queue cannot be passed through the worker options. Scope the contract instead.
Returns a shallow copy — the workflow/activity definitions are shared by reference, which matters: defineContract treats the same definition object reused across scopes as one activity, not a collision.
Type Parameters
| Type Parameter |
|---|
TContract extends ContractDefinition |
Parameters
| Parameter | Type |
|---|---|
contract | TContract |
id | string |
Returns
TContract