GitHub

History & Analytics

Query historical runs, flaky tests, duration regressions, and export CSV datasets with zr history.

The zr history command suite queries historical execution logs stored in SQLite (history.db) using the high-performance in-process DuckDB analytical engine.

Requirement: Ensure @duckdb/node-api is installed in your project to use analytical history commands: npm i -D @duckdb/node-api.


Subcommands

Subcommand Description
zr history runs List recent test runs with pass rates, duration, and commit/branch metadata.
zr history flaky Identify flaky tests across runs and display their failure-to-pass retry recovery rates.
zr history regressions List tests that recently transitioned from passing to failing.
zr history slow Find slowest tests and specs sorted by P95 duration.
zr history tests List all unique test cases with lifetime pass rates and execution counts.
zr history files Aggregate historical metrics grouped by test spec file.

Global Table & Display Options

All table-producing history commands (runs, files, tests, flaky, regressions, slow, query) support standard display flags:

  • --all: Display or export all records, bypassing the default 25-record pagination window.
  • --limit <N>: Limit output or export to the top N records (e.g. --limit 10).
  • -e, --export [filename]: Export query results directly to an RFC 4180 compliant CSV file.
  • --interactive: Force interactive pagination mode even when redirected or run with arguments.

CSV Dataset Export (--export / -e)

Any history subcommand can export its dataset directly to CSV for spreadsheet analysis or reporting pipelines:

Terminal window
# Export top 50 slowest tests to slow-tests.csv
npx zr history slow --limit 50 --export slow-tests.csv
# Export all flaky tests to an auto-named CSV file
npx zr history flaky --all --export

Auto-Generated Filenames

When --export is passed without an explicit filename, Zen Reports generates a timestamped filename automatically:

history-<subcommand>-YYYYMMDD-HHmmss.csv

Example: history-flaky-20261125-143022.csv.