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-apiis 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 topNrecords (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:
# Export top 50 slowest tests to slow-tests.csvnpx zr history slow --limit 50 --export slow-tests.csv
# Export all flaky tests to an auto-named CSV filenpx zr history flaky --all --exportAuto-Generated Filenames
When --export is passed without an explicit filename, Zen Reports generates a timestamped filename automatically:
history-<subcommand>-YYYYMMDD-HHmmss.csvExample: history-flaky-20261125-143022.csv.