sincecutoff.com
← all changes

k6 adds an opt-in machine-readable summary

Introduced 2026-01-05 · score 0.98

HOW TO USE IT

When exporting a k6 end-of-test summary in structured form, enable the machine-readable format and write it with `--summary-export` or `handleSummary()`.

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) }; }

WHY THIS HELPS

Export a k6 test run summary in a structured format for a CI pipeline or custom analysis script.

REQUIREMENTS AND LIMITATIONS

  • 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/

FIRST-PARTY EVIDENCE

Check the installed version and the source before using it. Entry JSON

Report a problem with this card