Running tests
Per-repo test commands and what they cover
Every Ionize repo uses Vitest as its primary test runner (ADR 0020). Most repos also have Playwright for end-to-end.
Per repo
dashboard
cd dashboard
bun run test # vitest run
bun run test:watch # vitest watch
bun run test:e2e # playwright testTests cover:
services/kratos/*adapters (mocked Ory clients).lib/*utilities.- Route handlers (with mocked services).
- A small Playwright suite that exercises login → identity create → identity delete.
auth
cd auth
bun run test
bun run test:e2eTests cover:
- Captcha + breach-check integration.
- Flow rendering with mocked Kratos.
- Playwright login flow.
platform
cd platform
bun run testTests cover:
- The reload sidecar.
init-db.sqlshape verification.- Compose YAML validation.
sdk
cd sdk
bun run testTests cover:
- Encryption format round-trip.
- HKDF derivation.
- Brute-force counter logic.
- Settings cache TTL.
canvas
cd canvas
bun run testTests cover component behavior (Vitest + React Testing Library) and visual regression via Playwright for a small set of components.
site
cd site
bun run test:e2eSite is mostly content; Vitest unit tests are minimal. The Playwright suite exercises the OAuth2 playground.
ionctl
cd ionctl
bun run testTests cover CLI command parsing and the bundled stack file existence.
deploy
cd deploy
bun run test # frontend tests (Vitest)
cargo test --manifest-path src-tauri/Cargo.toml # backend tests (Rust)Running everything
From the parent Ionize/ directory:
for repo in dashboard auth platform sdk canvas site ionctl deploy; do
echo "=== $repo ==="
cd $repo
bun run test || echo "FAIL: $repo"
cd ..
doneCI
Every push runs the test suite for the affected repo. CI workflows live at .github/workflows/ci.yml in each repo.
When tests fail in CI but pass locally
Common causes:
- Environment vars. Some tests pull from
process.env. CI may not have them set. - Snapshot files. Vitest's
toMatchSnapshotwrites to disk; if CI's snapshot differs from local, you might have stale snapshots committed. - Bun version mismatch. Local Bun vs CI's Bun may behave differently. Pin via
package.json'sengines. - Network access. CI runners may not have outbound to the same external services your local tests touch. Mock those.
Coverage
bun run test -- --coverageCoverage isn't enforced as a CI gate by default, per directive (No Coverage Until User Says Push), iteration doesn't fail builds on coverage thresholds.