reporting-labs 0.6.21 → 0.6.22

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
@@ -448,7 +448,7 @@ Every option is optional. `npx reporting-labs init` writes them all, with commen
448
448
  | `jsonFile` | `'report.json'` | File name of the JSON blob |
449
449
  | `pdf` | `true` | Also write `report.pdf` (light theme, print-ready), printed by Playwright's Chromium or an installed Chrome / Edge, whatever browser the tests ran on. `false` turns it off; `{ file: 'run.pdf' }` renames it; `{ chromePath }` (or `CHROME_PATH`) names the browser. The Export PDF button in the report works either way |
450
450
  | `embedFonts` | `true` | Bundle the fonts (~140 KB) so it looks the same offline |
451
- | `announce` | `true` | Print the report path after the run |
451
+ | `announce` | `true` | Print the report path after the run. On a developer's machine (never in CI) it also asks for a GitHub star, at most once a week; `REPORTING_LABS_NO_STAR=1` turns only that off |
452
452
  | `open` | `'on-failure'` | Open the report in the browser after the run: `'on-failure'`, `'always'` or `'never'`. Never opens in CI |
453
453
  | `commentMeta` | `true` | Also read meta from the comment above a test or `describe` (`/** @priority P0 @owner naveen */`). `meta()` wins when both are there. `false` reads no comments |
454
454
  | `warnMissingMeta` | `true` | After the run, list the tests that have no meta (no `meta()` and no comment) in the console, so nobody on the team forgets |
package/dist/reporter.js CHANGED
@@ -47,6 +47,7 @@ const mask_1 = require("./mask");
47
47
  const explain_1 = require("./explain");
48
48
  const pdf_1 = require("./pdf");
49
49
  const bdd_1 = require("./bdd");
50
+ const star_1 = require("./star");
50
51
  const comments_1 = require("./comments");
51
52
  const DEFAULT_EMBED_LIMIT = 2 * 1024 * 1024;
52
53
  /** Attach steps created by log() and the automatic API capture; the data shows in its own section, so hide the step. */
@@ -282,6 +283,11 @@ class ReportingLabsReporter {
282
283
  }
283
284
  if (this.options.pdf !== false)
284
285
  await this.writePdf(file);
286
+ if (this.options.announce !== false) {
287
+ const star = (0, star_1.starLine)();
288
+ if (star)
289
+ console.log(star + '\n');
290
+ }
285
291
  this.maybeOpen(file, result);
286
292
  }
287
293
  /** report.pdf next to the HTML; see writeReportPdf for which browser prints it. Never fails the run. */
package/dist/star.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export declare const STAR_URL = "https://github.com/naveenautomationlabs/reporting-labs";
2
+ export declare function starLine(env?: NodeJS.ProcessEnv, mark?: string): string | undefined;
package/dist/star.js ADDED
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.STAR_URL = void 0;
37
+ exports.starLine = starLine;
38
+ /**
39
+ * At most once a week, on a developer's machine, one line after the report asking for a GitHub star: most people
40
+ * who use the reporter never see the repository. Never in CI. Off with announce: false or REPORTING_LABS_NO_STAR=1.
41
+ */
42
+ const fs = __importStar(require("fs"));
43
+ const os = __importStar(require("os"));
44
+ const path = __importStar(require("path"));
45
+ const CI_VARS = ['CI', 'TF_BUILD', 'JENKINS_URL', 'GITLAB_CI', 'BUILDKITE', 'CIRCLECI', 'TEAMCITY_VERSION', 'CODEBUILD_BUILD_ID', 'BITBUCKET_BUILD_NUMBER'];
46
+ const WEEK = 7 * 24 * 3600 * 1000;
47
+ exports.STAR_URL = 'https://github.com/naveenautomationlabs/reporting-labs';
48
+ function starLine(env = process.env, mark = path.join(os.tmpdir(), 'reporting-labs-star')) {
49
+ if (env.REPORTING_LABS_NO_STAR || CI_VARS.some(k => env[k]))
50
+ return undefined;
51
+ try {
52
+ if (Date.now() - fs.statSync(mark).mtimeMs < WEEK)
53
+ return undefined;
54
+ }
55
+ catch { /* never shown on this machine */ }
56
+ // the time it was shown is what keeps it to once a week: if it cannot be kept, stay quiet
57
+ try {
58
+ fs.writeFileSync(mark, '');
59
+ }
60
+ catch {
61
+ return undefined;
62
+ }
63
+ return ` ★ If reportingLabs helps you, a GitHub star helps other testers find it: ${exports.STAR_URL}`;
64
+ }
@@ -201,6 +201,9 @@ a{color:var(--accent)}
201
201
 
202
202
  /* ---------- detail ---------- */
203
203
  .detail{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);padding:22px;min-width:0}
204
+ /* a long URL, path or token with no spaces (an OAuth redirect in a step error) breaks instead of widening the page */
205
+ .detail :is(.e,.crumb,.loc,.errloc,.txt,.logs,.note,.err,.kv dd,.kv2 dd){overflow-wrap:anywhere}
206
+ .detail .kv{grid-template-columns:auto minmax(0,1fr)} .detail .kv2{grid-template-columns:max-content minmax(0,1fr)}
204
207
  .crumb{font-size:12px;color:var(--ink-3)} .crumb span+span::before{content:" / ";color:var(--line)}
205
208
  .detail h3{font-size:20px;font-weight:600;margin:6px 0 10px;letter-spacing:-.01em;overflow-wrap:anywhere;min-width:0}
206
209
  .badges{display:flex;gap:6px;flex-wrap:wrap;align-items:center;margin-bottom:18px}
@@ -678,6 +681,7 @@ html,body{font-size:var(--fs)}
678
681
  .rl-foot-mark{width:22px;height:22px;display:inline-flex;flex:none}
679
682
  .rl-foot-mark svg{width:22px;height:22px;display:block;border-radius:6px}
680
683
  .rl-foot-txt b{color:var(--ink-2);font-weight:600}
684
+ .rl-star{color:var(--ink-2);text-decoration:none} .rl-star:hover{color:var(--accent-2);text-decoration:underline}
681
685
  @media print{ .rl-foot{display:none} }
682
686
 
683
687
  /* ---------- print / PDF: a clean, client-shareable executive report ----------
@@ -1160,7 +1164,8 @@ function rlFooter(){
1160
1164
  return h('footer',{class:'rl-foot'},
1161
1165
  h('span',{class:'rl-foot-mark',html:svg}),
1162
1166
  h('span',{class:'rl-foot-txt'}, 'Generated by ', h('b',{},'reportingLabs'),
1163
- data.generatedAt? ' · '+new Date(data.generatedAt).toLocaleString() : null));
1167
+ data.generatedAt? ' · '+new Date(data.generatedAt).toLocaleString() : null,
1168
+ ' · ', h('a',{class:'rl-star',href:'https://github.com/naveenautomationlabs/reporting-labs',target:'_blank',rel:'noopener'},'\u2605 Star on GitHub')));
1164
1169
  }
1165
1170
 
1166
1171
  /* ---------- summary ---------- */
package/dist/template.js CHANGED
@@ -272,6 +272,9 @@ a{color:var(--accent)}
272
272
 
273
273
  /* ---------- detail ---------- */
274
274
  .detail{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);padding:22px;min-width:0}
275
+ /* a long URL, path or token with no spaces (an OAuth redirect in a step error) breaks instead of widening the page */
276
+ .detail :is(.e,.crumb,.loc,.errloc,.txt,.logs,.note,.err,.kv dd,.kv2 dd){overflow-wrap:anywhere}
277
+ .detail .kv{grid-template-columns:auto minmax(0,1fr)} .detail .kv2{grid-template-columns:max-content minmax(0,1fr)}
275
278
  .crumb{font-size:12px;color:var(--ink-3)} .crumb span+span::before{content:" / ";color:var(--line)}
276
279
  .detail h3{font-size:20px;font-weight:600;margin:6px 0 10px;letter-spacing:-.01em;overflow-wrap:anywhere;min-width:0}
277
280
  .badges{display:flex;gap:6px;flex-wrap:wrap;align-items:center;margin-bottom:18px}
@@ -749,6 +752,7 @@ html,body{font-size:var(--fs)}
749
752
  .rl-foot-mark{width:22px;height:22px;display:inline-flex;flex:none}
750
753
  .rl-foot-mark svg{width:22px;height:22px;display:block;border-radius:6px}
751
754
  .rl-foot-txt b{color:var(--ink-2);font-weight:600}
755
+ .rl-star{color:var(--ink-2);text-decoration:none} .rl-star:hover{color:var(--accent-2);text-decoration:underline}
752
756
  @media print{ .rl-foot{display:none} }
753
757
 
754
758
  /* ---------- print / PDF: a clean, client-shareable executive report ----------
@@ -1226,7 +1230,8 @@ function rlFooter(){
1226
1230
  return h('footer',{class:'rl-foot'},
1227
1231
  h('span',{class:'rl-foot-mark',html:svg}),
1228
1232
  h('span',{class:'rl-foot-txt'}, 'Generated by ', h('b',{},'reportingLabs'),
1229
- data.generatedAt? ' · '+new Date(data.generatedAt).toLocaleString() : null));
1233
+ data.generatedAt? ' · '+new Date(data.generatedAt).toLocaleString() : null,
1234
+ ' · ', h('a',{class:'rl-star',href:'https://github.com/naveenautomationlabs/reporting-labs',target:'_blank',rel:'noopener'},'\u2605 Star on GitHub')));
1230
1235
  }
1231
1236
 
1232
1237
  /* ---------- summary ---------- */
@@ -44,6 +44,7 @@ const template_1 = require("./template");
44
44
  const mask_1 = require("./mask");
45
45
  const pdf_1 = require("./pdf");
46
46
  const env_1 = require("./wdio/env");
47
+ const star_1 = require("./star");
47
48
  /** Writes the report into options.outputFolder (default reporting-labs) and returns the HTML path. */
48
49
  async function writeReport(tests, run, options = {}) {
49
50
  const outputFolder = options.outputFolder || 'reporting-labs';
@@ -134,8 +135,12 @@ async function writeReport(tests, run, options = {}) {
134
135
  }
135
136
  if (options.pdf !== false)
136
137
  await writePdf(htmlFile, outputFolder, options);
137
- if (options.announce !== false)
138
+ if (options.announce !== false) {
139
+ const star = (0, star_1.starLine)();
140
+ if (star)
141
+ console.log(star);
138
142
  console.log('');
143
+ }
139
144
  return htmlFile;
140
145
  }
141
146
  /** report.pdf next to the HTML; see writeReportPdf for which browser prints it (an installed Chrome or
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "reporting-labs",
3
- "version": "0.6.21",
3
+ "version": "0.6.22",
4
4
  "description": "reportingLabs – beautiful, customizable single-file HTML test reports. One line of config. Playwright adapter included, more runners on the way.",
5
5
  "keywords": [
6
6
  "test-report",