You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/adr/005-local-integration-tests.md
+43-6Lines changed: 43 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,13 +8,34 @@ Accepted
8
8
9
9
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.
10
10
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.
|**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.
12
31
13
32
### ministack blockers
14
33
34
+
Despite winning the emulator comparison, ministack hit two hard blockers when integrated:
35
+
15
36
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.
16
37
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.
18
39
19
40
### Chosen approach: in-process Bun server
20
41
@@ -34,7 +55,23 @@ Use an in-process `Bun.serve()` proxy as the local test target. No Docker, no ex
34
55
35
56
## Consequences
36
57
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.
0 commit comments