{
  "slug": "k6-adds-an-opt-in-machine-readable-summary-7b0b5264d322",
  "title": "k6 adds an opt-in machine-readable summary",
  "tools": [
    "k6"
  ],
  "tags": [
    "agent"
  ],
  "introduced_at": "2026-01-05T19:37:51.000Z",
  "announced_at": "2026-01-05T19:37:51.000Z",
  "effective_at": null,
  "date_basis": "source-publication",
  "status": "unknown",
  "how": {
    "incantation": "When exporting a k6 end-of-test summary in structured form, enable the machine-readable format and write it with `--summary-export` or `handleSummary()`.",
    "examples": [
      "k6 run script.js --new-machine-readable-summary --summary-export=summary.json",
      "K6_NEW_MACHINE_READABLE_SUMMARY=true k6 run --summary-export summary.json script.js",
      "export function handleSummary(data) { return { 'summary.json': JSON.stringify(data) }; }"
    ],
    "gotchas": [
      "Version: v1.5.0",
      "Availability: Currently opt-in; the format will become the default in k6 v2.",
      "--new-machine-readable-summary: Enables the new machine-readable summary format; used for `--summary-export` and as the `handleSummary()` argument.",
      "K6_NEW_MACHINE_READABLE_SUMMARY: Environment variable that enables the machine-readable format; set to a boolean value such as `true`.",
      "--summary-export <filename>: For `k6 run`, saves the end-of-test summary report to a JSON file; `<filename>` is the output path.",
      "handleSummary(data): End-of-test callback receiving the aggregated summary object; return a map whose string keys are `stdout`, `stderr`, or file paths and whose values are strings or `ArrayBuffer`.",
      "Prerequisite: The documented `--summary-export` command is available with `k6 run`.",
      "Prerequisite: The machine-readable format was introduced in k6 v1.5.0; the v1.5.0 release note says it is opt-in.",
      "The format is currently opt-in.",
      "Docs conflict: Current options documentation discourages `--summary-export` and recommends `handleSummary()` for flexible exports; it still documents the flag and its JSON output. This guidance is from newer documentation than v1.5.0. https://grafana.com/docs/k6/latest/using-k6/k6-options/reference/"
    ]
  },
  "why_it_matters": "Export a k6 test run summary in a structured format for a CI pipeline or custom analysis script.",
  "sources": [
    "https://github.com/grafana/k6/releases/tag/v1.5.0",
    "https://github.com/grafana/k6/blob/v1.5.0/internal/cmd/runtime_options.go",
    "https://grafana.com/docs/k6/latest/results-output/end-of-test/custom-summary/",
    "https://grafana.com/docs/k6/latest/using-k6/k6-options/reference/"
  ],
  "rank": 0.98042,
  "judge": {
    "publish": true,
    "judge_model": "codex-cli/gpt-6-luna+typesafe/jev-1.13.0",
    "prompt_version": "extract-v7+enrich-v2+judge-v2x3+jev-publish-v1"
  },
  "review_state": "approved",
  "provenance": {
    "run_id": "wave2a-20261017",
    "verdict_id": "wave2a-20261017:wave2a-20261017-586cf8a8904fff8d-7:gate",
    "evidence_hash": "a56e3f88b056059d85ecbdf65359def0fbd1d2054d8cb41abb9141ea3143a06c"
  },
  "review": {
    "draft_hash": "1e6e48c373279688500388091dd9e5ae624538dde92db6f38acdfe8e012dbd1b",
    "reviewer": "publication-gate",
    "reviewed_at": "2026-10-07T00:00:00.000Z",
    "decision": "wave2a-20261017:gate",
    "reason": "3 of 3 judge runs approved with p_yes >= 0.9 (mean 0.98 >= 0.9; 2 needed) and Jev gave 0.73 (>= 0.6 needed)."
  }
}
