reporting-labs 0.4.2 → 0.4.3

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
@@ -53,6 +53,17 @@ Done. Everything below is optional.
53
53
 
54
54
  > **In a hurry?** Skip the config file and pass options inline: `reporter: [['reporting-labs', { title: 'My app' }]]`.
55
55
 
56
+ ## See everything the report can do
57
+
58
+ Every card and tab is switched on. What you see depends on what your tests give it:
59
+
60
+ 1. **Add `meta()` to your tests** and the report ranks failures by priority, groups them by owner and feature, and links to your stories. See [the helpers](#add-details-to-your-tests-3-small-helpers).
61
+ 2. **Run the suite twice** and the Trend chart, "new vs known" failures, flaky dots and "Got slower" appear. History is kept in `reporting-labs.history.json`.
62
+ 3. **Turn on Playwright's `screenshot`, `video` and `trace`** in `playwright.config.ts` and they show up on every failed test.
63
+ 4. **Have more than one Playwright project** (say chromium and webkit) and you get a feature × project heatmap.
64
+
65
+ The report tells you about these itself: a card that has nothing to show yet explains what to do.
66
+
56
67
  ## Add details to your tests (3 small helpers)
57
68
 
58
69
  The report already shows steps, screenshots, videos, traces and errors on its own. Three small helpers add the rest. Import them from `reporting-labs` and call them inside a test.
@@ -3,6 +3,9 @@ import type { ReportingLabsOptions } from 'reporting-labs';
3
3
 
4
4
  // reportingLabs configuration.
5
5
  // Every option is optional. Lines that start with // show the default; uncomment and change what you need.
6
+ // All cards and tabs are on by default. What the report shows depends on your tests: add meta() for
7
+ // priorities and owners, run the suite twice for trends and flaky detection, and keep Playwright's
8
+ // screenshot / video / trace settings on. A card with nothing to show yet tells you what to do.
6
9
  // Docs: https://github.com/naveenautomationlabs/reporting-labs#options
7
10
 
8
11
  const config: ReportingLabsOptions = {
package/dist/template.js CHANGED
@@ -268,6 +268,7 @@ a{color:var(--accent)}
268
268
  .item .tt .n{font-size:13px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
269
269
  .item .d{font:11px var(--mono);color:var(--ink-3);margin-top:3px}
270
270
  .empty{padding:40px 20px;text-align:center;color:var(--ink-3)}
271
+ .nudge{font-size:var(--fs-s);color:var(--ink-2);background:var(--surface-2);border:1px dashed var(--line);border-radius:var(--radius);padding:10px 12px;margin-bottom:10px;line-height:1.5} .nudge code{font-family:var(--mono);font-size:12px} .nudge b{color:var(--ink)}
271
272
 
272
273
  /* ---------- detail ---------- */
273
274
  .detail{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);padding:22px;min-width:0}
@@ -872,6 +873,7 @@ function summary(){
872
873
  if(W.skipped!==false) { const sc=skippedCard(); if(sc) g.push(sc); }
873
874
  if(W.environment!==false) { const ec=envCard(); if(ec) g.push(ec); }
874
875
  if(data.history.length>1) g.push(h('div',{class:'card w12'}, h('h2',{},'Trend', h('span',{class:'hint'},'last '+data.history.length+' runs')), trend()));
876
+ else if(data.history.length===1) g.push(h('div',{class:'card w12'}, h('h2',{},'Trend', h('span',{class:'hint'},'from the second run')), h('div',{class:'nudge'}, h('b',{},'First run recorded.'),' Run the suite once more and this card shows the pass-rate trend, and every failure gets "new this run" or "failing since #…", last-10-runs dots, a Flakiest tests card and a Got slower tab. History lives in ',h('code',{},data.historyFile||'reporting-labs.history.json'),', commit it or cache it in CI.')));
875
877
  const ge=data.globalErrors||[], go=data.globalOutput||[];
876
878
  if(ge.length||go.some(x=>x.stream==='err')) g.unshift(h('div',{class:'card w12 fail-rail'}, h('h2',{}, ge.length? ge.length+' error'+(ge.length>1?'s':'')+' outside tests' : 'Output outside tests', h('span',{class:'hint'},'spec files that failed to load, global setup, worker crashes')),
877
879
  ...ge.map(errorView), go.length? h('details',{class:'errfull'}, h('summary',{},'Console output outside tests ('+go.length+' chunks)'), h('pre',{class:'txt'}, go.map(x=>(x.stream==='err'?'[stderr] ':'')+x.text).join(''))) : null));
@@ -1137,10 +1139,11 @@ function breakdown(){
1137
1139
  if(data.options.widgets.tags&&data.tests.some(t=>t.tags.length)) tabs.push(['tags','Tags',tagsChart]);
1138
1140
  if(data.projects.length>1&&DIMS.length) tabs.push(['heat','Heatmap',heatmap]);
1139
1141
  if(!tabs.length) return h('div',{class:'empty'},'Add meta({ priority, severity, owner, feature }) to your tests to see breakdowns here.');
1142
+ const nudge=!DIMS.length? h('div',{class:'nudge'}, h('b',{},'Tip:'),' add ',h('code',{},"meta({ priority: 'P1', severity: 'major', owner: 'priya', feature: 'checkout' })"),' at the top of a test and this card gains Priority, Severity, Feature and Owner tabs, the failures get ranked, and owners get their own rollup.') : null;
1140
1143
  let cur=tabs[0][0]; const bar=h('div',{class:'bk-tabs'}), body=h('div',{});
1141
1144
  const render=()=>{ body.innerHTML=''; body.append(tabs.find(t=>t[0]===cur)[2]()); bar.querySelectorAll('button').forEach(b=>b.setAttribute('aria-selected',b.dataset.k===cur)); };
1142
1145
  for(const [k,l] of tabs) bar.append(h('button',{'data-k':k,onclick:()=>{cur=k;render();}},l));
1143
- render(); return h('div',{}, bar, body);
1146
+ render(); return h('div',{}, nudge, bar, body);
1144
1147
  }
1145
1148
  function errorSignature(msg){
1146
1149
  return (msg||'').split('\n')[0].replace(/\d+(\.\d+)?(ms|s)\b/g,'N').replace(/\b\d{2,}\b/g,'N').replace(/["'][^"']{0,60}["']/g,'"…"').replace(/\s+/g,' ').trim().slice(0,160);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "reporting-labs",
3
- "version": "0.4.2",
3
+ "version": "0.4.3",
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",