Linear and Ramp twins work viaDocumentation Index
Fetch the complete documentation index at: https://docs.archal.ai/llms.txt
Use this file to discover all available pages before exploring further.
archal run and archal twin start but don’t yet have route-mode manifests for Vitest.
Prerequisites.
archal/vitest talks to hosted twins provisioned by the Archal control plane, so every run needs an auth token — either run archal login once on your laptop or set ARCHAL_TOKEN=arc_... (recommended in CI). The first hosted session in a process spends ~30 seconds while AWS provisions an ECS-backed twin; later runs within the 30-minute TTL reuse that session and finish in ~2 seconds. Budget for the cold start in your test timeouts and CI step timings.Install
ARCHAL_TOKEN instead of running archal login.
Add Archal to your existing vitest.config.ts
If your project already has a vitest.config.ts, wrap the value of test: with withArchal. It’s a merge helper — every field you already had (coverage, alias, globalSetup, poolOptions, custom reporters, etc.) is preserved, and Archal composes its setup file, reporter, and session env on top.
{} as the first argument: withArchal({}, { services: { ... } }).
Or add a separate project in vitest.workspace.ts
For monorepos or when only a subset of tests should hit twins, use a workspace:
include glob will provision hosted twins; the rest run as normal Vitest.
Write a test
Your test code uses normal SDK clients or direct HTTP calls. Route mode intercepts the HTTP traffic and redirects it to twins. No base URL configuration, no SDK mocking.(name, services, seeds) hash).
Seeds
Seeds control the twin’s starting state. Omitseed: to get a twin’s default empty state. Pass a named seed for a known fixture (e.g. small-project on GitHub gives you one repo with a few issues and PRs). Named seeds are documented per twin in Seeds.
Reset state between tests
Inspect the session
If you need to check which services, seeds, or versions the backend resolved:Troubleshooting
- Real API responses instead of twin responses — your test file isn’t matched by the project’s
includeglob. - 401 at setup —
ARCHAL_TOKENisn’t set (orarchal loginwasn’t run). - Test hangs for 30+ seconds on first run — that’s the ECS cold-start, not a hang.
- Reset isn’t working — call
resetArchalTwins()inbeforeEach, notbeforeAll. - CI credential race — when multiple jobs run in parallel, export
ARCHAL_TOKENdirectly instead of relying on~/.archal/credentials.json.
