reporting-labs 0.6.14 โ†’ 0.6.15

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
@@ -345,7 +345,7 @@ Every outcome Playwright can produce, not just pass and fail:
345
345
  | Single HTML file, opens without a server | โŒ<br><sub>a folder, served by `show-report`</sub> | ๐ŸŸก<br><sub>single-file mode (2.24+, Allure 3)</sub> | โœ… |
346
346
  | Nothing extra to install | โœ… | โŒ<br><sub>Allure CLI; Allure 2 needs Java</sub> | โœ…<br><sub>one package</sub> |
347
347
  | Setup | โœ…<br><sub>built in</sub> | ๐ŸŸก<br><sub>reporter + generate step</sub> | โœ…<br><sub>one line</sub> |
348
- | Frameworks | โŒ<br><sub>Playwright only</sub> | โœ…<br><sub>many languages</sub> | โœ…<br><sub>Playwright, WebdriverIO, pytest, Robot, JUnit 5, TestNG, Cucumber</sub> |
348
+ | Frameworks | โŒ<br><sub>Playwright only</sub> | โœ…<br><sub>many languages</sub> | โœ…<br><sub>Playwright, WebdriverIO, pytest, pytest-bdd, Robot, JUnit 5, TestNG, Cucumber</sub> |
349
349
  | **Each test** | | | |
350
350
  | Steps, screenshots, videos, traces | โœ… | โœ… | โœ… |
351
351
  | Logs and test data | ๐ŸŸก<br><sub>as attachments</sub> | ๐ŸŸก<br><sub>attachments, parameters</sub> | โœ…<br><sub>`log()`, `testData()`</sub> |
@@ -400,6 +400,7 @@ Every option is optional. `npx reporting-labs init` writes them all, with commen
400
400
  | `theme` | `'auto'` | `'light'`, `'dark'` or follow the OS |
401
401
  | `customCss` | `''` | CSS appended to the report |
402
402
  | `editorLinks` | on locally, off in CI | "Open in VS Code" links |
403
+ | `expandFailedSteps` | `true` | Open the steps that lead to a failure. `false`: every step with sub-steps starts collapsed (also on failures); **Expand all / Collapse all** above the steps either way |
403
404
  | `bdd` | auto | Style Given/When/Then steps as Gherkin |
404
405
  | `outputFolder` | `'reporting-labs'` | Where the report goes |
405
406
  | `outputFile` | `'index.html'` | Report file name |
@@ -60,6 +60,7 @@ const seed = {
60
60
  accent: ACCENT_SENTINEL,
61
61
  customCss: CUSTOM_SENTINEL,
62
62
  editorLinks: true,
63
+ expandFailedSteps: true,
63
64
  },
64
65
  };
65
66
 
@@ -61,6 +61,7 @@ const config: ReportingLabsOptions = {
61
61
  // },
62
62
  // maskKeys: ['otp', 'pan'], // extra keys to mask as **** (passwords, tokens, cookies already are)
63
63
  // editorLinks: true, // "Open in VS Code" on every test; default: on locally, off in CI
64
+ // expandFailedSteps: true, // open the steps leading to a failure; false = all steps start collapsed
64
65
  // bdd: false, // style Given/When/Then steps as Gherkin; default: auto-detect
65
66
 
66
67
  // โ”€โ”€ Run history and trend โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
package/dist/reporter.js CHANGED
@@ -234,6 +234,7 @@ class ReportingLabsReporter {
234
234
  links: this.linkUrls(),
235
235
  customCss: this.options.customCss ?? '',
236
236
  editorLinks: this.options.editorLinks ?? !process.env.CI,
237
+ expandFailedSteps: this.options.expandFailedSteps ?? true,
237
238
  },
238
239
  };
239
240
  const file = path.join(this.outDir, this.options.outputFile ?? 'index.html');
@@ -229,6 +229,9 @@ a{color:var(--accent)}
229
229
  .step.skip .t,.step.skip .kw,.step.skip .d{color:var(--ink-3);font-style:italic}
230
230
  .step .e{font:12px var(--mono);color:var(--fail);padding:2px 0 6px 28px;white-space:pre-wrap}
231
231
  li.collapsed>ul{display:none}
232
+ .st-h{display:flex;align-items:baseline;gap:8px;flex-wrap:wrap} .detail .st-h .hint{margin-left:0} .st-h .st-tools{margin-left:auto;display:inline-flex;gap:12px;text-transform:none;letter-spacing:0}
233
+ .st-tools button{background:none;border:0;padding:0;font:500 12px var(--sans);color:var(--accent);cursor:pointer} .st-tools button:hover{text-decoration:underline}
234
+ @media print{.st-tools{display:none}}
232
235
  .att{display:grid;grid-template-columns:repeat(auto-fill,minmax(180px,1fr));gap:10px}
233
236
  .att figure{margin:0;border:1px solid var(--line);border-radius:var(--radius);overflow:hidden;background:var(--surface-2)}
234
237
  .att img{width:100%;display:block;aspect-ratio:16/10;object-fit:cover;cursor:zoom-in}
@@ -1724,7 +1727,9 @@ function renderDetail(t, d, retryIdx){
1724
1727
  const body=h('div',{});
1725
1728
  if(t.note&&retry===t.results.length-1) body.append(h('div',{class:'note '+(t.outcome==='passed'?'ok':'warn')}, t.note));
1726
1729
  if(r.errors.length){ body.append(h('h4',{},r.errors.length>1?'Errors':'Error'), ...r.errors.map(errorView)); }
1727
- if(r.steps.length){ const stepTotal=Math.max(1, r.duration||0, r.steps.reduce((a,x)=>a+x.duration,0)); body.append(h('h4',{},data.bdd?'Scenario steps':'Steps', h('span',{class:'hint'},'bar = share of '+ms(stepTotal))), stepTree(r.steps, stepTotal)); }
1730
+ if(r.steps.length){ const stepTotal=Math.max(1, r.duration||0, r.steps.reduce((a,x)=>a+x.duration,0)); const tree=stepTree(r.steps, stepTotal), nested=r.steps.some(x=>x.steps.length);
1731
+ body.append(h('h4',{class:'st-h'},data.bdd?'Scenario steps':'Steps', h('span',{class:'hint'},'bar = share of '+ms(stepTotal)),
1732
+ nested? h('span',{class:'st-tools'}, h('button',{type:'button',onclick:()=>setSteps(tree,false)},'Expand all'), h('button',{type:'button',onclick:()=>setSteps(tree,true)},'Collapse all')) : null), tree); }
1728
1733
  if(r.logs.length){ const t0=r.startTime; body.append(h('h4',{},'Log'), h('div',{class:'logs'}, r.logs.map(l=>h('div',{class:'ln'+(/\b(error|fail|exception)\b/i.test(l.msg)?' err':/\bwarn/i.test(l.msg)?' warn':'')}, h('span',{class:'ts'},'+'+ms(Math.max(0,l.t-t0))), h('span',{class:'lm'},l.msg))))); }
1729
1734
  for(const b of r.data){ body.append(h('h4',{},b.name), dataBlock(b)); }
1730
1735
  if(r.api.length){ body.append(h('h4',{},r.api.length+' API call'+(r.api.length>1?'s':'')), ...r.api.map(c=>apiPanel(c,r))); body.append(h('div',{class:'mask-note'},'Secrets and auth headers are masked as ****')); }
@@ -1757,7 +1762,8 @@ function renderDetail(t, d, retryIdx){
1757
1762
  function stepTree(steps, total){
1758
1763
  return h('ul',{class:'steps'}, steps.map(s=>{
1759
1764
  const bad=!!s.error, skip=s.status==='skipped', kids=s.steps.length>0, pct=total?Math.min(100,s.duration/total*100):0;
1760
- const li=h('li',{class:kids&&!hasError(s)?'collapsed':''});
1765
+ // a step with sub-steps starts collapsed; the path to a failure starts open unless expandFailedSteps is false
1766
+ const li=h('li',{class:kids&&(data.options.expandFailedSteps===false||!hasError(s))?'collapsed':''});
1761
1767
  const row=h('div',{class:'step'+(bad?' bad':'')+(skip?' skip':'')},
1762
1768
  h('span',{class:'tw'}, kids? 'โ–ธ' : ''), data.bdd?null:h('span',{class:'cat'},s.category), gherkin(s.title), total&&!skip? h('span',{class:'tb',title:Math.round(pct)+'% of the test'}, h('i',{class:pct>=30?'slow':'',style:'width:'+Math.max(pct,s.duration>0?1.5:0)+'%'})) : null, h('span',{class:'d'},skip?'not run':ms(s.duration)));
1763
1769
  if(kids){ row.style.cursor='pointer'; row.addEventListener('click',()=>{li.classList.toggle('collapsed'); row.querySelector('.tw').textContent=li.classList.contains('collapsed')?'โ–ธ':'โ–พ';}); if(!li.classList.contains('collapsed')) row.querySelector('.tw').textContent='โ–พ'; }
@@ -1767,6 +1773,7 @@ function stepTree(steps, total){
1767
1773
  }
1768
1774
  function gherkin(title){ const m=data.bdd&&title.match(/^(Given|When|Then|And|But)\b\s*(.*)$/); if(!m) return h('span',{class:'t',title},title); return h('span',{class:'t',title}, h('span',{class:'kw'+(/^(And|But)$/.test(m[1])?' and':'')},m[1]), m[2]); }
1769
1775
  function hasError(s){ return !!s.error || s.steps.some(hasError); }
1776
+ function setSteps(tree, collapsed){ for(const li of tree.querySelectorAll('li')){ const tw=li.querySelector(':scope>.step>.tw'); if(!tw||!tw.textContent) continue; li.classList.toggle('collapsed',collapsed); tw.textContent=collapsed?'โ–ธ':'โ–พ'; } }
1770
1777
  function dataBlock(b){
1771
1778
  if(b.kind==='table') return h('div',{}, h('div',{class:'tbl-wrap'}, h('table',{class:'tbl'}, h('thead',{}, h('tr',{}, b.columns.map(c=>h('th',{},c)))), h('tbody',{}, b.rows.map(r=>h('tr',{}, r.map(c=>h('td',{class:c==='****'?'mask':'',title:c},c))))))), h('div',{class:'mask-note'}, b.rows.length+' rows ยท sensitive columns masked'));
1772
1779
  if(b.kind==='kv') return h('dl',{class:'kv2'}, b.kv.map(([k,v])=>[h('dt',{},k),h('dd',{class:v==='****'?'mask':''},v)]));
package/dist/template.js CHANGED
@@ -300,6 +300,9 @@ a{color:var(--accent)}
300
300
  .step.skip .t,.step.skip .kw,.step.skip .d{color:var(--ink-3);font-style:italic}
301
301
  .step .e{font:12px var(--mono);color:var(--fail);padding:2px 0 6px 28px;white-space:pre-wrap}
302
302
  li.collapsed>ul{display:none}
303
+ .st-h{display:flex;align-items:baseline;gap:8px;flex-wrap:wrap} .detail .st-h .hint{margin-left:0} .st-h .st-tools{margin-left:auto;display:inline-flex;gap:12px;text-transform:none;letter-spacing:0}
304
+ .st-tools button{background:none;border:0;padding:0;font:500 12px var(--sans);color:var(--accent);cursor:pointer} .st-tools button:hover{text-decoration:underline}
305
+ @media print{.st-tools{display:none}}
303
306
  .att{display:grid;grid-template-columns:repeat(auto-fill,minmax(180px,1fr));gap:10px}
304
307
  .att figure{margin:0;border:1px solid var(--line);border-radius:var(--radius);overflow:hidden;background:var(--surface-2)}
305
308
  .att img{width:100%;display:block;aspect-ratio:16/10;object-fit:cover;cursor:zoom-in}
@@ -1790,7 +1793,9 @@ function renderDetail(t, d, retryIdx){
1790
1793
  const body=h('div',{});
1791
1794
  if(t.note&&retry===t.results.length-1) body.append(h('div',{class:'note '+(t.outcome==='passed'?'ok':'warn')}, t.note));
1792
1795
  if(r.errors.length){ body.append(h('h4',{},r.errors.length>1?'Errors':'Error'), ...r.errors.map(errorView)); }
1793
- if(r.steps.length){ const stepTotal=Math.max(1, r.duration||0, r.steps.reduce((a,x)=>a+x.duration,0)); body.append(h('h4',{},data.bdd?'Scenario steps':'Steps', h('span',{class:'hint'},'bar = share of '+ms(stepTotal))), stepTree(r.steps, stepTotal)); }
1796
+ if(r.steps.length){ const stepTotal=Math.max(1, r.duration||0, r.steps.reduce((a,x)=>a+x.duration,0)); const tree=stepTree(r.steps, stepTotal), nested=r.steps.some(x=>x.steps.length);
1797
+ body.append(h('h4',{class:'st-h'},data.bdd?'Scenario steps':'Steps', h('span',{class:'hint'},'bar = share of '+ms(stepTotal)),
1798
+ nested? h('span',{class:'st-tools'}, h('button',{type:'button',onclick:()=>setSteps(tree,false)},'Expand all'), h('button',{type:'button',onclick:()=>setSteps(tree,true)},'Collapse all')) : null), tree); }
1794
1799
  if(r.logs.length){ const t0=r.startTime; body.append(h('h4',{},'Log'), h('div',{class:'logs'}, r.logs.map(l=>h('div',{class:'ln'+(/\b(error|fail|exception)\b/i.test(l.msg)?' err':/\bwarn/i.test(l.msg)?' warn':'')}, h('span',{class:'ts'},'+'+ms(Math.max(0,l.t-t0))), h('span',{class:'lm'},l.msg))))); }
1795
1800
  for(const b of r.data){ body.append(h('h4',{},b.name), dataBlock(b)); }
1796
1801
  if(r.api.length){ body.append(h('h4',{},r.api.length+' API call'+(r.api.length>1?'s':'')), ...r.api.map(c=>apiPanel(c,r))); body.append(h('div',{class:'mask-note'},'Secrets and auth headers are masked as ****')); }
@@ -1823,7 +1828,8 @@ function renderDetail(t, d, retryIdx){
1823
1828
  function stepTree(steps, total){
1824
1829
  return h('ul',{class:'steps'}, steps.map(s=>{
1825
1830
  const bad=!!s.error, skip=s.status==='skipped', kids=s.steps.length>0, pct=total?Math.min(100,s.duration/total*100):0;
1826
- const li=h('li',{class:kids&&!hasError(s)?'collapsed':''});
1831
+ // a step with sub-steps starts collapsed; the path to a failure starts open unless expandFailedSteps is false
1832
+ const li=h('li',{class:kids&&(data.options.expandFailedSteps===false||!hasError(s))?'collapsed':''});
1827
1833
  const row=h('div',{class:'step'+(bad?' bad':'')+(skip?' skip':'')},
1828
1834
  h('span',{class:'tw'}, kids? 'โ–ธ' : ''), data.bdd?null:h('span',{class:'cat'},s.category), gherkin(s.title), total&&!skip? h('span',{class:'tb',title:Math.round(pct)+'% of the test'}, h('i',{class:pct>=30?'slow':'',style:'width:'+Math.max(pct,s.duration>0?1.5:0)+'%'})) : null, h('span',{class:'d'},skip?'not run':ms(s.duration)));
1829
1835
  if(kids){ row.style.cursor='pointer'; row.addEventListener('click',()=>{li.classList.toggle('collapsed'); row.querySelector('.tw').textContent=li.classList.contains('collapsed')?'โ–ธ':'โ–พ';}); if(!li.classList.contains('collapsed')) row.querySelector('.tw').textContent='โ–พ'; }
@@ -1833,6 +1839,7 @@ function stepTree(steps, total){
1833
1839
  }
1834
1840
  function gherkin(title){ const m=data.bdd&&title.match(/^(Given|When|Then|And|But)\b\s*(.*)$/); if(!m) return h('span',{class:'t',title},title); return h('span',{class:'t',title}, h('span',{class:'kw'+(/^(And|But)$/.test(m[1])?' and':'')},m[1]), m[2]); }
1835
1841
  function hasError(s){ return !!s.error || s.steps.some(hasError); }
1842
+ function setSteps(tree, collapsed){ for(const li of tree.querySelectorAll('li')){ const tw=li.querySelector(':scope>.step>.tw'); if(!tw||!tw.textContent) continue; li.classList.toggle('collapsed',collapsed); tw.textContent=collapsed?'โ–ธ':'โ–พ'; } }
1836
1843
  function dataBlock(b){
1837
1844
  if(b.kind==='table') return h('div',{}, h('div',{class:'tbl-wrap'}, h('table',{class:'tbl'}, h('thead',{}, h('tr',{}, b.columns.map(c=>h('th',{},c)))), h('tbody',{}, b.rows.map(r=>h('tr',{}, r.map(c=>h('td',{class:c==='****'?'mask':'',title:c},c))))))), h('div',{class:'mask-note'}, b.rows.length+' rows ยท sensitive columns masked'));
1838
1845
  if(b.kind==='kv') return h('dl',{class:'kv2'}, b.kv.map(([k,v])=>[h('dt',{},k),h('dd',{class:v==='****'?'mask':''},v)]));
package/dist/types.d.ts CHANGED
@@ -116,6 +116,8 @@ export interface ReportingLabsOptions {
116
116
  env?: Record<string, string>;
117
117
  /** Show an "Open in VS Code" link on every test (vscode://file/...). Default: true locally, false when the CI env var is set. */
118
118
  editorLinks?: boolean;
119
+ /** Open the steps that lead to a failure when a failed test is opened (default true). false: every step with sub-steps starts collapsed, also on failures. */
120
+ expandFailedSteps?: boolean;
119
121
  /** Style Given/When/Then steps as Gherkin and label describe blocks as Features/Scenarios. Default: auto-detect */
120
122
  bdd?: boolean;
121
123
  }
@@ -341,5 +343,6 @@ export interface ReportData {
341
343
  links: Record<string, string>;
342
344
  customCss: string;
343
345
  editorLinks: boolean;
346
+ expandFailedSteps?: boolean;
344
347
  };
345
348
  }
@@ -35,5 +35,6 @@ export interface ReportingLabsCompleteOptions {
35
35
  maskFromEnv?: boolean;
36
36
  embedFonts?: boolean;
37
37
  editorLinks?: boolean;
38
+ expandFailedSteps?: boolean;
38
39
  }
39
40
  export declare function reportingLabsComplete(options?: ReportingLabsCompleteOptions): Promise<string | undefined>;
@@ -156,6 +156,7 @@ async function reportingLabsComplete(options = {}) {
156
156
  links: Object.fromEntries(Object.entries(options.links ?? {}).map(([k, v]) => [k.toLowerCase(), typeof v === 'string' ? v : v.url])),
157
157
  customCss: options.customCss ?? '',
158
158
  editorLinks: options.editorLinks ?? !process.env.CI,
159
+ expandFailedSteps: options.expandFailedSteps ?? true,
159
160
  },
160
161
  };
161
162
  fs.mkdirSync(outputFolder, { recursive: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "reporting-labs",
3
- "version": "0.6.14",
3
+ "version": "0.6.15",
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",