Testing
Alien provides a testing framework that deploys your stack and runs assertions against it.
Local Testing
The default mode. Runs alien dev as a child process, deploys your stack locally, and exposes the same API as a cloud deployment:
import { deploy, type Deployment } from "@alienplatform/testing"
let deployment: Deployment
beforeAll(async () => {
deployment = await deploy({ app: ".", platform: "local" })
}, 120_000)
afterAll(async () => {
await deployment.destroy()
})
test("health check", async () => {
const res = await fetch(`${deployment.url}/health`)
expect(res.ok).toBe(true)
})
test("storage works", async () => {
const res = await fetch(`${deployment.url}/storage-test/data`)
const body = await res.json()
expect(body.status).toBe("ok")
})Local mode uses the same bindings and resource implementations as production — sled for KV/Queue, filesystem for Storage, plaintext files for Vault. Your application code doesn't know the difference.
Cloud Testing
For integration tests against real cloud services, set ALIEN_API_KEY and specify a platform:
const deployment = await deploy({
app: ".",
platform: "aws", // or "gcp", "azure"
})Cloud mode builds your app, creates a release, provisions real infrastructure, and deploys. Tests run against actual S3, DynamoDB, Lambda, etc.
CI Pipeline
A typical CI setup:
# .github/workflows/test.yml
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
- run: bun install
- run: bun testLocal tests require no cloud credentials — they run entirely on the CI machine.