aerostack test
Run your project’s tests using Vitest with the Cloudflare Workers runtime pool. Tests run in an environment that matches your production edge runtime.
aerostack test [flags]| Flag | Description |
|---|---|
--coverage | Generate a coverage report |
Examples
Section titled “Examples”# Run all testsaerostack test
# Run with coverageaerostack test --coverageHow it works
Section titled “How it works”- Auto-generates
.aerostack/wrangler.test.tomlwith test bindings - Builds
dist/worker.js - Runs Vitest with
@cloudflare/vitest-pool-workers
Tests have access to all D1, KV, and other bindings, running in the actual Workers runtime.
Writing tests
Section titled “Writing tests”import { describe, it, expect } from 'vitest'import { env } from 'cloudflare:test'
describe('auth', () => { it('registers a new user', async () => { const response = await fetch('http://localhost/v1/public/projects/my-app/auth/register', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ email: 'test@example.com', password: 'securepass' }) })
expect(response.status).toBe(201) const body = await response.json() expect(body.user.email).toBe('test@example.com') })})Configuration
Section titled “Configuration”Tests read your aerostack.toml for bindings. The test environment uses local D1 and KV, isolated per test run.