CLI Overview & Modes
Command-line execution modes, terminal summary output, and environment flags in Zen Reports.
Zen Reports for Playwright provides a built-in command-line interface executable (npx zr or npx zen-reporter) for previewing test reports, diagnosing runtime environments, performing cross-run test intelligence analytics, and managing the local SQLite historical database.
Execution Modes
1. Interactive Menu Mode (TTY)
When executed without arguments in an interactive terminal session (process.stdin.isTTY and process.stdout.isTTY), npx zr launches a guided wizard powered by @clack/prompts:
npx zr- Interactive Selection: Navigate commands, subcommands, and options using your arrow keys and press
Enterto select. - Escape Key Handling: Press
Escat any sub-prompt or confirmation dialog to step back to the previous menu level or safely cancel the operation. - Integrated Pagination: Commands producing tabular output support interactive paging (
Next 25,Show All Remaining,Export All to CSV,Finish & Back).
2. Direct Command Execution (Non-Interactive / CI Pipelines)
When run with specific command-line arguments or in non-TTY environments (such as CI/CD runners, GitHub Actions, or pipes):
- Prompts are automatically bypassed.
- Defaults to standard non-interactive limits (e.g. top 25 records).
- Exits cleanly with standard exit codes (
0on success,1on error).
Test Execution Terminal Summary
When tests are executed with Zen Reports for Playwright configured in Playwright (npx playwright test), Zen Reports streams test status in real-time and prints an ASCII summary table on completion:
-
Live TTY Stream: Differentiates between initial failure retry attempts (
🔁 [RETRYING] ... (attempt 1/2)), tests recovered on retry (🔄 [FLAKY] ... (passed on attempt 2/2)), and fatal failures (❌ [FAILED] ...). -
Terminal Summary Table: Provides complete visibility into all outcomes, ensuring column counts sum to the total:
Test Summary: My E2E Project — Test Run #1+--------+----------+-----------+-------+--------+-------+--------+-----------+-------------+---------+| Status | Duration | Pass Rate | Total | Passed | Flaky | Failed | Timed Out | Interrupted | Skipped |+--------+----------+-----------+-------+--------+-------+--------+-----------+-------------+---------+| PASSED | 12s | 100% | 25 | 24 | 1 | 0 | 0 | 0 | 0 |+--------+----------+-----------+-------+--------+-------+--------+-----------+-------------+---------+(Note:
Passedrepresents first-run clean passes, whileFlakytracks tests that failed initially but passed on retry.)

Environment Variables
| Variable | Description | Default |
|---|---|---|
ZEN_REPORT_DIR |
Custom path to the report directory containing index.html and history.db. |
'zen-report' |
CI |
Auto-detected boolean flag. When set, forces non-interactive table output. | undefined |
Next Steps
Explore individual CLI command reference guides:
| Capability | Command Guide |
|---|---|
| Core Commands | zr show, zr summary, zr env, and zr help: Core Commands |
| History & Analytics | Query flaky tests, regressions, and slow specs: History & Analytics |
| Database Maintenance | Clean, vacuum, and migrate historical databases: Database Maintenance |
| Custom SQL Queries | Run ad-hoc SQL queries against SQLite/DuckDB history: Custom SQL Queries |