@arpanp/zen-reporter 0.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Arpan Patelia
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,146 @@
1
+ # Zen Reporter
2
+
3
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
4
+
5
+ Beautiful test execution reports for Playwright.
6
+
7
+ Zen Reporter transforms Playwright's raw test results into an interactive, visually stunning dashboard. It provides a clean, modern interface for exploring test suites, analyzing pass/fail rates, and diving into individual test failures with full step-by-step execution traces, source code snippets, syntax highlighting, and error stacks.
8
+
9
+ Light mode:
10
+
11
+ ![Dashboard Overview - Light Mode](docs/screenshots/light-mode.png)
12
+
13
+ Dark mode:
14
+
15
+ ![Dashboard Overview - Dark Mode](docs/screenshots/dark-mode.png)
16
+
17
+ ## Features
18
+
19
+ - **High-Level Test Dashboard**: Visual summary metrics featuring pass rate radial indicators, execution efficiency, health breakdowns, run environment details (duration, projects, suites, test counts, worker threads), and calculation tooltips.
20
+ - **Per-Project Execution Analytics**: Detailed status bar charts, volume and coverage distribution, and project detail cards comparing Playwright project profiles.
21
+ - **Suite & Spec File Explorer**: Interactive, searchable tree view container for nested `describe` suites with collapsible nodes, bulk expand/collapse controls, retry badges, test case cards, and paginated spec file summary tables.
22
+ - **Deep-Dive Failure Analysis**: Detailed root cause analysis with two grouping modes (file grouping and error signature clustering to group identical root causes into Shared Issue clusters), step-by-step execution traces with target indicators (`▶`), source code snippets with syntax highlighting, diff stack traces (`Expected` vs `Received`), and retry attempt tabs (`Run`, `Retry #1`).
23
+ - **Visual Regression Diff Viewer**: Built-in side-by-side snapshot comparison for visual regression testing, allowing interactive comparison of `actual`, `expected` (baseline), and overlay `diff` image attachments.
24
+ - **Execution History Archiving**: Archive historical test runs with details on run metadata, execution modes (`Parallel, N workers` vs `Serial`), wall-clock duration, pass/fail ratios, and automated quality ratings (`Excellent`, `Needs improvement`, `Critical`).
25
+ - **File & Test Case History**: Dedicated **File History** and **Test History** views to analyze long-term spec file stability, individual test case pass/fail rates, run counts, average execution durations, date-range filtering, and text search across historical runs.
26
+ - **Export to CSV**: Lightweight, RFC 4180-compliant UTF-8 CSV exporter for all report tables (Files, History, Insights). Respects active filters/date ranges and exports un-paginated full datasets for easy data sharing and external analysis.
27
+ - **Visual Quality Trends**: Track pass rate percentages over time, multi-project execution duration trends per project profile, and step category trends across historical runs.
28
+ - **DuckDB-Powered Test Intelligence**: Embedded analytics engine for advanced test suite intelligence:
29
+ - **Flaky Intelligence**: Detect tests fluctuating between pass and fail across historical runs.
30
+ - **Regression Tracking**: Identify tests that previously passed but regressed to failed in the latest run.
31
+ - **Slowest Tests Analysis**: Rank top slowest test cases by average execution duration across runs.
32
+ - **P95 Duration & Latency**: Analyze 95th percentile completion thresholds per project profile.
33
+ - **Core Platform Capabilities**:
34
+ - **Themes & Dark Mode**: Multiple design themes (`Cafe`, `Concept`, `Sentinel`) with light and dark mode toggles, built with WCAG-compliant color tokens and configurable default states.
35
+ - **Single-File Standalone Output**: Generates a self-contained single-file HTML report (`index.html`) with embedded datasets for easy sharing and CI/CD artifact storage. Optionally creates a lightweight standalone `summary.html` dedicated to executive dashboards.
36
+
37
+ ---
38
+
39
+ ## Installation
40
+
41
+ ```bash
42
+ npm install @arpanp/zen-reporter
43
+ ```
44
+
45
+ ---
46
+
47
+ ## Configuring Zen Reporter in Playwright
48
+
49
+ Add `zen-reporter` to your `playwright.config.ts` (or `playwright.config.js`):
50
+
51
+ ### Basic Configuration
52
+
53
+ ```ts
54
+ import { defineConfig } from '@playwright/test';
55
+
56
+ export default defineConfig({
57
+ reporter: 'zen-reporter',
58
+ });
59
+ ```
60
+
61
+ ### Advanced Configuration (With Options)
62
+
63
+ You can pass configuration options using the tuple syntax in Playwright:
64
+
65
+ ```ts
66
+ import { defineConfig } from '@playwright/test';
67
+
68
+ export default defineConfig({
69
+ reporter: [
70
+ [
71
+ 'zen-reporter',
72
+ {
73
+ outputDir: 'zen-report', // Optional: Output directory where report files will be generated (default: "zen-report")
74
+ projectName: 'My E2E Project', // Optional: Project name displayed in the top bar header
75
+ testRunName: 'Nightly Build #42', // Optional: Test run / build name displayed in the top bar header
76
+ theme: 'Cafe', // Optional: Theme applied on initial load ("Cafe" | "Concept" | "Sentinel", default: "Cafe")
77
+ darkMode: false, // Optional: Initial dark mode state (default: false)
78
+ singleSummaryFile: true, // Optional: Generates a standalone summary.html file alongside index.html
79
+ minimalReport: false, // Optional: Produces a lightweight, basic report (disables history, hides analytical charts & secondary tabs, default: false)
80
+ enableHistory: 'auto', // Optional: History recording mode ("auto" | boolean, default: "auto")
81
+ consoleProgress: 'auto', // Optional: Console execution progress output ("auto" | "line" | "dot" | false, default: "auto")
82
+ },
83
+ ],
84
+ ],
85
+ });
86
+ ```
87
+
88
+ ### Options Reference
89
+
90
+ | Option | Type | Default | Description |
91
+ | :------------------ | :------------------------------------- | :-------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------ |
92
+ | `outputDir` | `string` | `"zen-report"` | Directory where final report files are saved. |
93
+ | `projectName` | `string` | `"Test Automation Project"` | Project name displayed prominently in the top bar of the dashboard. |
94
+ | `testRunName` | `string` | `"Test Run #{N}"` | Test run or build name displayed in top bar. `{N}` is replaced dynamically by run number. |
95
+ | `theme` | `string` | `"Cafe"` | Theme applied on first load (`"Cafe"`, `"Concept"`, `"Sentinel"`). |
96
+ | `darkMode` | `boolean` | `false` | When set to `true`, the report loads in dark mode on first load. |
97
+ | `singleSummaryFile` | `boolean` | `false` | Generates a standalone `summary.html` for executive summary views. |
98
+ | `minimalReport` | `boolean` | `false` | When `true`, disables history recording and hides analytical charts/secondary tabs (Projects, History, Trends, Insights) for a lean report. |
99
+ | `enableHistory` | `'auto' \| boolean` | `"auto"` | Controls history execution archiving (`"auto"`, `true`, `false`). Forced to `false` when `minimalReport` is `true`. |
100
+ | `consoleProgress` | `'auto' \| 'line' \| 'dot' \| boolean` | `"auto"` | Controls terminal execution output (`"auto"` selects `line` in TTY and `dot` in non-TTY). |
101
+
102
+ ---
103
+
104
+ ## Usage
105
+
106
+ ### 1. Running Tests
107
+
108
+ Run your Playwright tests as usual. Zen Reporter will stream live progress directly to your console (`line` mode in interactive terminals or `dot` mode in non-TTY environments) and display summary table upon test completion, while building structured suite trees and generating the standalone HTML report:
109
+
110
+ ```bash
111
+ npx playwright test
112
+ ```
113
+
114
+ ### 2. Viewing the Generated Report
115
+
116
+ Launch the built-in report server to open the interactive dashboard in your browser using `npx zr show`:
117
+
118
+ ```bash
119
+ npx zr show
120
+ ```
121
+
122
+ ### 3. CLI Commands Reference (`zr`)
123
+
124
+ Zen Reporter includes a built-in CLI executable (`npx zr`) for serving reports and querying historical test execution data:
125
+
126
+ #### Report & Summaries
127
+
128
+ - **`npx zr show`** — Launch the report server to view `index.html` in your default browser.
129
+ - **`npx zr summary`** — Output Markdown summary snippet for current run results (ideal for PR comments or Slack).
130
+
131
+ #### History & Intelligence (`zr history`)
132
+
133
+ > **Note**: History commands analyze stored JSONL run logs via DuckDB. Ensure `@duckdb/node-api` is installed in your project (`npm i -D @duckdb/node-api`).
134
+
135
+ | Command | Description |
136
+ | :-------------------------------- | :------------------------------------------------------------------------------------------------- |
137
+ | `npx zr history` | List all historical test runs with start time, duration, and pass/fail/skip counts. |
138
+ | `npx zr history runs` | Same as above. List all historical test runs with start time, duration, and pass/fail/skip counts. |
139
+ | `npx zr history files` | Summarize historical test execution metrics grouped by spec file. |
140
+ | `npx zr history tests` | Summarize granular historical execution metrics and average durations per test case. |
141
+ | `npx zr history flaky` | Identify flaky tests that passed in some runs and failed in others. |
142
+ | `npx zr history regressions` | List tests that passed in a previous run but failed in the latest run. |
143
+ | `npx zr history slow [--limit N]` | Rank the top $N$ slowest tests by average execution duration across runs (default: 10). |
144
+ | `npx zr history trend` | Display historical pass rate percentages per run over time. |
145
+ | `npx zr history report` | Build `history.json` and inject it into `index.html` to populate the History & Trends tabs. |
146
+ | `npx zr history query "<SQL>"` | Run arbitrary DuckDB SQL queries over recorded test runs. |