Skip to main content
@siglo/testing provides a comprehensive, zero-flake test harness for deterministic execution, step mocking, spy inspection, virtual timers, execution trace snapshots, and production failure replay.

1. The Workflow Harness

Create a test harness wrapping any workflow:

2. Spies and Assertions

Inspect step calls, attempt counts, inputs, and outputs:

3. Step Mocking

Replace third-party dependencies or expensive external APIs without modifying workflow code:

4. Fake Clock & Virtual Timers

Control virtual timestamps for harness trace records without setTimeout delays in tests. Note that FakeClock advances its own timestamp counter and tick() flushes pending microtasks via setImmediate; it does not mock Node’s global Date.now or setTimeout.

5. Execution Records and Failure Replay

Export sanitized execution records from real executions or staging runs and replay them locally:

Minimal Example


Failure Example: Catching Regressions with Replay


Testing Example: Full Mocking & Spying


Operational Caveats

  1. Secret Redaction: Always run sanitizeExecutionRecord() before writing execution records to bug reports or test fixtures. Defaults automatically redact passwords, API keys, and credit cards.
  2. Deterministic Randomness: If steps generate UUIDs or timestamps, inject a deterministic clock or generator via param.$services so replays produce matching records.
  3. Trace Inspection: The test harness records both 'start' and 'complete' phases for every step in harness.getTrace(). Filter by phase if asserting distinct step names.