A lightweight TypeScript interpreter for AWS Step Functions' Amazon States Language (ASL), built for local testing.
Best for: testing workflow logic locally with mocked Task resources
Not for: production workflow execution, durable state, or full AWS emulation
npm install tiny-asl-machine
pnpm add tiny-asl-machine
yarn add tiny-asl-machineimport { run, type StateDefinition } from 'tiny-asl-machine';
const definition: StateDefinition = {
StartAt: 'MyTask',
States: {
MyTask: {
Type: 'Task',
Resource: 'arn:aws:lambda:us-east-1:123456789012:function:MyFunction',
End: true,
},
},
};
const result = await run(
{
definition,
resourceContext: {
invoke: async (resource, input) => {
if (resource === 'arn:aws:lambda:us-east-1:123456789012:function:MyFunction') {
return { processed: true, ...input };
}
throw new Error(`Unexpected resource: ${resource}`);
},
},
},
{ data: 'test' }
);Use Tiny ASL Machine when you want to:
- keep your ASL definition close to production
- mock
Taskresources in-process - test branching, dataflow, retries, catches, waits,
Map, andParallellocally - move quickly locally, then confirm parity-sensitive behavior on AWS
Do not use it as:
- a production Step Functions replacement
- a durable execution engine
- a persistence layer
- a full AWS service-integration emulator
| Area | Status | Notes |
|---|---|---|
| Core states | Strong | Task, Pass, Choice, Wait, Parallel, Map, Succeed, Fail |
| Dataflow | Strong | InputPath, OutputPath, ResultPath, Parameters, ResultSelector |
| Error handling | Strong | Catch and Retry for normal orchestration flows |
| Intrinsics | Strong | broad JSONPath intrinsic coverage |
| JSONata | Strong | one of the strongest areas of the project |
Advanced distributed Map / ItemReader |
Partial | common local cases work; advanced service-coupled shapes still need AWS |
| Callback / task-token fidelity | Partial | some support exists, but not full service fidelity |
| Durable execution | Out of scope | use AWS Step Functions for that |
For deeper status, use ASL_COMPATIBILITY.md.
The library matches Task resources by the exact Resource string in the ASL definition.
That means local tests can usually use the same definition you deploy, whether your file contains:
- deployment placeholders like
{chargeCustomerArn} - internal resource names
- full AWS ARNs
Use local tests for fast feedback. Use AWS-backed conformance when:
- behavior is parity-sensitive
- validation rules matter
- you are relying on less common ASL features
- you need a final answer on real Step Functions behavior
- Examples
- FAQ
- ASL compatibility guide
- Contributing
- Engineering playbook
- Skill: write local state machine tests
tests/sampleETLOrchestration.spec.ts— realistic exampletests/conformance/cases/— compatibility coverage by feature/grouptests/conformance.spec.ts— unified local/AWS conformance runner
Tiny ASL Machine gives you a high-confidence local testing workflow for a large part of real Step Functions logic.
For production semantics and hard edge cases, AWS remains the authority.
MIT - See LICENSE