akua / cli / test

akua test

Run unit tests for packages, policies, or both. Unified test runner across engines — detects target types by file extension.

akua test [path] [flags]

Discovers and runs:

Flags

flagdescription
--coverageemit per-rule / per-schema coverage report
--watchre-run on file change
--goldenenable / verify golden-output comparisons
--filter=<regex>run only matching tests
--timeout=<dur>per-test timeout (default 30s)
`--engine=<auto\embedded\shell>`engine selection (see embedded-engines.md)

Exit codes

0 if all pass, 1 if any fail, 2 on infrastructure error.

JSON output

{
  "summary": { "passed": 24, "failed": 1, "skipped": 2, "duration_ms": 413 },
  "results": [
    {
      "file":     "policies/production_test.rego",
      "test":     "test_deny_missing_team_label",
      "status":   "pass",
      "duration_ms": 12
    },
    {
      "file":     "packages/api/test_api.k",
      "test":     "test_default_replicas",
      "status":   "fail",
      "message":  "expected replicas=3, got 1",
      "duration_ms": 8
    }
  ],
  "coverage": { "overall": 0.72, "by_rule": { "deny_budget_exceeded": 0.0 } }
}