@arpanp/zen-reporter 0.10.1 → 0.11.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/README.md CHANGED
@@ -34,8 +34,12 @@ Dark mode:
34
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
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
36
 
37
+ > **Note**: Designed and built with AI pair-programming tools; fully tested, maintained, and quality-assured by human hands.
38
+
37
39
  ---
38
40
 
41
+ > **Compatibility**: Zen Reporter is designed for standard Playwright test suites and does not support BDD-styled tests (e.g. Cucumber / `playwright-bdd`).
42
+
39
43
  ## Installation
40
44
 
41
45
  ```bash
@@ -121,12 +125,13 @@ npx zr show
121
125
 
122
126
  ### 3. CLI Commands Reference (`zr`)
123
127
 
124
- Zen Reporter includes a built-in CLI executable (`npx zr`) for serving reports and querying historical test execution data:
128
+ Zen Reporter includes a built-in CLI executable (`npx zr`) for serving reports, checking system environment, and querying historical test execution data:
125
129
 
126
- #### Report & Summaries
130
+ #### Report & Environment
127
131
 
128
132
  - **`npx zr show`** — Launch the report server to view `index.html` in your default browser.
129
133
  - **`npx zr summary`** — Output Markdown summary snippet for current run results (ideal for PR comments or Slack).
134
+ - **`npx zr env`** — Print environment details (`zen-reporter` version, `@playwright/test` version, Node.js version, OS).
130
135
 
131
136
  #### History & Intelligence (`zr history`)
132
137
 
@@ -140,7 +145,7 @@ Zen Reporter includes a built-in CLI executable (`npx zr`) for serving reports a
140
145
  | `npx zr history tests` | Summarize granular historical execution metrics and average durations per test case. |
141
146
  | `npx zr history flaky` | Identify flaky tests that passed in some runs and failed in others. |
142
147
  | `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). |
148
+ | `npx zr history slow [--limit N]` | Rank the top `N` slowest tests by average execution duration across runs (default: 10). |
144
149
  | `npx zr history trend` | Display historical pass rate percentages per run over time. |
145
150
  | `npx zr history report` | Build `history.json` and inject it into `index.html` to populate the History & Trends tabs. |
146
151
  | `npx zr history query "<SQL>"` | Run arbitrary DuckDB SQL queries over recorded test runs. |
@@ -407,6 +407,61 @@ function generateMarkdownSummaryFromReport(reportData) {
407
407
  return md;
408
408
  }
409
409
 
410
+ import { createRequire } from 'module';
411
+ import { platform, type } from 'os';
412
+
413
+ function getOsName() {
414
+ const p = platform();
415
+ if (p === 'darwin') return 'macOS';
416
+ if (p === 'win32') return 'Windows';
417
+ if (p === 'linux') {
418
+ try {
419
+ if (existsSync('/etc/os-release')) {
420
+ const content = readFileSync('/etc/os-release', 'utf8');
421
+ const match = content.match(/^PRETTY_NAME="?([^"\n]+)"?/m);
422
+ if (match && match[1]) return match[1];
423
+ }
424
+ } catch {
425
+ /* ignore */
426
+ }
427
+ return 'Linux';
428
+ }
429
+ return type();
430
+ }
431
+
432
+ function getPlaywrightVersion(cwd) {
433
+ const require = createRequire(resolve(cwd, 'package.json'));
434
+ try {
435
+ const pwPkg = require('@playwright/test/package.json');
436
+ return pwPkg.version || 'not installed';
437
+ } catch {
438
+ return 'not installed';
439
+ }
440
+ }
441
+
442
+ function getZenReporterVersion() {
443
+ try {
444
+ const pkgPath = resolve(
445
+ import.meta.dirname || new URL('.', import.meta.url).pathname,
446
+ '../package.json'
447
+ );
448
+ if (existsSync(pkgPath)) {
449
+ const pkg = JSON.parse(readFileSync(pkgPath, 'utf8'));
450
+ return pkg.version || 'unknown';
451
+ }
452
+ } catch {
453
+ /* ignore */
454
+ }
455
+ return 'unknown';
456
+ }
457
+
458
+ function handleEnv() {
459
+ console.log(`zen-reporter version: ${getZenReporterVersion()}`);
460
+ console.log(`@playwright/test version: ${getPlaywrightVersion(cwd)}`);
461
+ console.log(`Node.js version: ${process.version}`);
462
+ console.log(`OS: ${getOsName()}`);
463
+ }
464
+
410
465
  function printHelp() {
411
466
  console.log(`
412
467
  Zen Reporter CLI
@@ -414,6 +469,7 @@ Zen Reporter CLI
414
469
  Usage:
415
470
  npx zr show Serve and view the HTML report
416
471
  npx zr summary Output Markdown summary snippet for current run results
472
+ npx zr env Print environment details (versions, OS)
417
473
  npx zr history List historic runs
418
474
  npx zr history runs Same as above
419
475
  npx zr history flaky Tests that failed in some runs and passed in others
@@ -663,6 +719,8 @@ if (command === 'show') {
663
719
  console.error('✗ Failed to read report summary:', err.message || err);
664
720
  process.exit(1);
665
721
  }
722
+ } else if (command === 'env') {
723
+ handleEnv();
666
724
  } else if (command === 'history') {
667
725
  handleHistory(args.slice(1)).catch((e) => {
668
726
  console.error('✗ history command failed:', e?.message || e);