Skip to content

var run --json: emit SpecResults to stdout #82

Description

@AndreasKoestler

Follow-up to #66 (optional item, split out of the docs-only PR #80).

var run today prints human-readable ✓/✗ output only. A --json flag would stream the same SpecResults records the vitest reporter persists to .var/<spec>.json — one JSON object per spec, or a single top-level array — so consumers don't need to know the on-disk layout.

The format itself is now documented and versioned: Run results reference.

Consumers (from #66 discussion)

  • Supervising agents / CI gates — answer "which examples ran, which passed, what drifted, where exactly did it fail" without scraping test-runner text output
  • Compliance / attestation pipelines (e.g. EU CRA evidence, Kosli-style artifact attestation) — attach "these documented behaviours were verified for this artifact" mechanically; the sourceHash fingerprint pins which version of the documented behaviour was verified

Design notes

  • Shape should be exactly the documented SpecResults (version: 1, specPath, sourceHash, examples[]) — no parallel wire format
  • Stability policy from the reference page applies: additive optional fields without a version bump; consumers ignore unknown fields
  • var lint --json already exists but emits plan diagnostics — keep the flag semantics distinct (run results, not lint output)
  • Open question: stream vs. array, and whether drift information (from var.lock.json reconciliation) is included or kept separate

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions