Skip to content

Commit 92ab31c

Browse files
ivanbarlogclaude
andcommitted
docs: consolidate local integration research into ADR 005, delete source docs
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 8d1381b commit 92ab31c

3 files changed

Lines changed: 43 additions & 251 deletions

File tree

docs/adr/005-local-integration-tests.md

Lines changed: 43 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,34 @@ Accepted
88

99
The existing integration tests (`integ:deploy-test-destroy`) deploy real CDK stacks to AWS, take ~30 minutes, and incur real cost. A faster local feedback loop was needed.
1010

11-
Two AWS emulators were evaluated: **ministack** and **floci**. ministack was chosen over floci for broader service coverage and CDK documentation. However, both approaches were ultimately abandoned in favour of a simpler alternative.
11+
### Emulators evaluated
12+
13+
Two free, MIT-licensed AWS emulators were compared — both emerged after LocalStack moved behind a paywall in March 2026.
14+
15+
| | ministack | floci |
16+
|---|---|---|
17+
| **Stars** | 2,945 | 12,549 |
18+
| **Lambda (Node.js)** | Native in-process | Docker required |
19+
| **Lambda (provided.al2023 / Bun)** | Docker RIE | Docker required |
20+
| **Lambda Function URLs** |||
21+
| **RESPONSE_STREAM** || ❌ explicitly 404 |
22+
| **CloudFront (data plane)** | ❌ API stubs only | ❌ none |
23+
| **CloudFormation** | Partial | Partial |
24+
| **AWS services** | 55+ | 47 |
25+
26+
ministack was preferred over floci because: it accepts CloudFront resource creation as a stub (so `cdk deploy` succeeds without a local-specific stack), it covers more services, and CDK usage is explicitly documented in the README. Floci's faster startup (24 ms vs 2 s) is irrelevant when test runs take minutes.
27+
28+
**Apple Container** was also evaluated as a Docker substitute — not viable: requires Socktainer (experimental, macOS 26 only) to expose a Docker-compatible socket, and has no Docker Compose support.
29+
30+
**RESPONSE_STREAM** is unsupported in all local tooling surveyed (ministack, floci, AWS SAM CLI, AWS Lambda RIE). Streaming tests remain AWS-only with no known local workaround.
1231

1332
### ministack blockers
1433

34+
Despite winning the emulator comparison, ministack hit two hard blockers when integrated:
35+
1536
1. **`AWS::Lambda::Url` not supported** — CDK stacks include `fn.addFunctionUrl()` which emits an `AWS::Lambda::Url` CloudFormation resource. ministack's CloudFormation emulation rejects it, so `cdk deploy` fails unconditionally.
1637

17-
2. **ESM top-level `await` not supported** — Falling back to the AWS SDK directly (`@aws-sdk/client-lambda`) and invoking the function through ministack's Lambda executor also failed. ministack's native Node.js executor loads handlers with `require()`, which Node.js refuses for ESM modules containing top-level `await` — which the SvelteKit adapter produces.
38+
2. **ESM top-level `await` not supported** — Falling back to the AWS SDK directly (`@aws-sdk/client-lambda`) and invoking the function through ministack's Lambda executor also failed. ministack's native Node.js executor loads handlers with `require()`, which Node.js refuses for ESM modules with top-level `await` — which the SvelteKit adapter produces.
1839

1940
### Chosen approach: in-process Bun server
2041

@@ -34,7 +55,23 @@ Use an in-process `Bun.serve()` proxy as the local test target. No Docker, no ex
3455

3556
## Consequences
3657

37-
- `bun run integ:local` runs 12 tests across 2 configs (esbuild + Node.js, Bun bundler + Node.js) in ~30 seconds.
38-
- No ministack dependency; `integ:local:start` script not needed.
39-
- BunBun (Bun custom runtime) stays AWS-only: `@beesolve/lambda-bun-runtime` introduces an `aws-cdk-lib` version conflict at the TypeScript level when imported alongside the root workspace.
40-
- Static asset (CloudFront→S3) and streaming (RESPONSE_STREAM) tests remain AWS-only — neither is expressible through a plain HTTP proxy.
58+
### What is tested locally
59+
60+
| Scenario | Local |
61+
|---|---|
62+
| EsbNode — esbuild + Node.js ||
63+
| BunNode — Bun bundler + Node.js ||
64+
| SSR home page, API routes, cookies, 404, redirects, `getAwsEvent()` | ✅ (6 tests per config) |
65+
| BunBun — Bun custom runtime | ❌ AWS-only |
66+
| Static assets (CloudFront → S3) | ❌ AWS-only |
67+
| Response streaming > 6 MB | ❌ AWS-only |
68+
69+
BunBun stays AWS-only because `@beesolve/lambda-bun-runtime` shares `aws-cdk-lib` with the root workspace at a different install path, causing TypeScript type conflicts. Static asset and streaming tests are structurally incompatible with a plain HTTP proxy.
70+
71+
### Running
72+
73+
```bash
74+
bun run integ:local # ~30 seconds, 12 tests
75+
```
76+
77+
No setup required — `beforeAll` builds both adapter configs and starts the servers; `afterAll` tears them down.

docs/local-integration-plan.md

Lines changed: 0 additions & 67 deletions
This file was deleted.

docs/local-integration-testing.md

Lines changed: 0 additions & 178 deletions
This file was deleted.

0 commit comments

Comments
 (0)