Mock worker
Configure test-only deterministic mock workers from the mock-workers schema: runType accept, script, or reject — not a Factory WorkerType.
How To Use
Author a mock-workers JSON config with a required mockWorkers array. Add selection entries that match the workerName, workstationName, or workInputs you want to intercept. Set runType to accept, reject, or script. Supply rejectConfig when runType is reject, and scriptConfig with at least command when runType is script. Enable the config on you run with --with-mock-workers. Keep Factory WorkerType values and worker body fields out of this file — they belong on factory.json workers, not on mock selection entries. accept returns a synthetic success; reject returns a configured rejection; script runs a local command through the shared command-runner boundary.Identity: runType = accept | script | reject (mock-workers schema, not WorkerType)
Enable mock-worker mode on you run with a JSON config path:
you run --dir ./factory --with-mock-workers ./mock-workers.jsonSchema Fields
The embed below shows the live mockWorker definition from the mock-workers schema. Required identity is runType. Selection fields include workerName, workstationName, workInputs, and optional id. Conditional fields include rejectConfig and scriptConfig. Open the full mock-workers schema reference for exhaustive field lookup rather than copying contract text into this page.mockWorker
objectSelects a worker dispatch and declares the deterministic behavior to apply at the execution boundary.
- additionalProperties
false (closed)
Fields
- id
idOptionalstring - runType
runTypeRequiredRequired run-type union selecting accept, script, or reject behavior.
- enum
"accept" | "script" | "reject"
- enum
- workerName
workerNameOptionalstring - workstationName
workstationNameOptionalstring
Examples
Use the minimal valid example when you need a single accept match for a named factory worker. The misuse example shows Factory Worker fields name and type MOCK_WORKER on a mock entry — mock selection uses workerName, never Factory WorkerType discriminators, and rejects unknown fields.Minimal valid mock-workers config:
{
"mockWorkers": [
{
"id": "reviewer-accepts",
"workerName": "reviewer",
"runType": "accept"
}
]
}
Incompatible misuse — Factory WorkerType shape on mock entry (rejected):
{
"mockWorkers": [
{
"name": "reviewer",
"type": "MOCK_WORKER",
"runType": "accept"
}
]
}
Mock selection entries use workerName, not name. They never accept type or other Factory WorkerType discriminators. Unknown fields fail validation at load time.