reporting-labs 0.6.24 → 0.6.25

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.
@@ -595,9 +595,9 @@ html,body{-webkit-font-smoothing:antialiased}
595
595
  .chg .seg:hover,.chg .seg[aria-expanded=true]{border-bottom-color:currentColor}
596
596
  .chg .seg.nf{color:var(--fail)} .chg .seg.fx{color:var(--pass)} .chg .seg.sf{color:var(--ink)} .chg .seg.sl{color:var(--flaky-ink)} .chg .seg.nt{color:var(--accent-2)}
597
597
  .chg .same{color:var(--ink-3)} .chg .spacer{flex:1}
598
- .chg-list[hidden]{display:none} .chg-list{flex-basis:100%;list-style:none;margin:2px 0 0;padding:8px 0 0;border-top:1px solid var(--line);display:grid;gap:2px}
598
+ .chg-list[hidden]{display:none} .chg-list{flex-basis:100%;min-width:0;max-height:396px;overflow-y:auto;list-style:none;margin:2px 0 0;padding:8px 0 0;border-top:1px solid var(--line);display:grid;grid-template-columns:minmax(0,1fr);gap:2px} .chg-list li{min-width:0}
599
599
  .chg-list button{display:flex;align-items:center;gap:8px;width:100%;text-align:left;padding:4px 6px;border-radius:6px;color:var(--ink);font:inherit;cursor:pointer;min-width:0} .chg-list button:hover{background:var(--surface-2)}
600
- .chg-list .st{width:8px;height:8px;border-radius:50%;flex:none} .chg-list .n{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap} .chg-list .f{margin-left:auto;flex:none;color:var(--ink-3);font-size:12px} .chg-list .more{color:var(--ink-3);font-size:12px;padding:4px 6px}
600
+ .chg-list .st{width:8px;height:8px;border-radius:50%;flex:none} .chg-list .n{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap} .chg-list .f{margin-left:auto;flex:none;max-width:40%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--ink-3);font-size:12px} .chg-list .more{color:var(--ink-3);font-size:12px;padding:4px 6px}
601
601
  .rerun{display:flex;align-items:center;gap:10px;margin:12px 0;padding:5px 5px 5px 12px;background:var(--surface-2);border-radius:6px;min-width:0}
602
602
  .rerun .k{flex:none;font-size:12px;color:var(--ink-3)} .rerun code{flex:1;min-width:0;font:12px var(--mono);color:var(--ink);white-space:nowrap;overflow:hidden;text-overflow:ellipsis} .rerun .btn{flex:none;background:var(--surface)}
603
603
  @media print{.chg,.rerun{display:none}}
@@ -1238,12 +1238,25 @@ function initials(name){ return (name||'').split(/[\s\-–—·]+/).filter(Boole
1238
1238
  function prevRun(){
1239
1239
  const H=data.history||[]; if(H.length<2) return null;
1240
1240
  const cur=H[H.length-1], n=cur.total||0;
1241
- const comparable=e=> isSmallRun(cur) ? (e.total||0)>=n/2 && (e.total||0)<=n*2 : !isSmallRun(e);
1241
+ // a pass rate is only compared with a run of a similar size: never a full run with a debug run of a few specs,
1242
+ // nor a re-run of the failed tests with the full run
1243
+ const comparable=e=> (e.total||0)>=n/2 && (e.total||0)<=n*2;
1242
1244
  let fallback=null;
1243
1245
  for(let i=H.length-2;i>=0;i--){ if(!comparable(H[i])) continue; if(!cur.label||H[i].label!==cur.label) return H[i]; if(!fallback) fallback=H[i]; }
1244
1246
  return fallback;
1245
1247
  }
1246
1248
 
1249
+ /* The run "Since last run" compares with: the latest earlier run that ran at least half of this run's tests. So a
1250
+ full run that follows a debug run of a few specs is compared with the last full run, and a re-run of the failed
1251
+ tests with the run they failed in. History written before per-test results were kept falls back to prevRun(). */
1252
+ function changesBase(){
1253
+ const H=data.history||[]; if(H.length<2) return null;
1254
+ const keys=data.tests.map(t=>t.key); if(!keys.length) return null;
1255
+ if(!H.slice(0,-1).some(e=>e.tests)) return prevRun();
1256
+ for(let i=H.length-2;i>=0;i--){ const e=H[i]; if(!e.tests) continue; let n=0; for(const k of keys) if(e.tests[k]) n++; if(n>=keys.length/2) return e; }
1257
+ return null;
1258
+ }
1259
+
1247
1260
  /* ---------- since last run, and the command to run tests again ---------- */
1248
1261
  /* The command that runs these tests again. The runner gives the shape in data.rerun ({pre, sep, post}) and each test
1249
1262
  its target first, then options it needs (Playwright: file:line, then --project=...). Targets and options are
@@ -1257,7 +1270,7 @@ function rerunCmd(ts){
1257
1270
  /* One line under the cards: what changed against the previous comparable run, each part opens its tests.
1258
1271
  Without history it still offers the command for the failed tests. */
1259
1272
  function changesLine(){
1260
- const p=prevRun(), base=p&&p.tests? p : null;
1273
+ const p=changesBase(), base=p&&p.tests? p : null;
1261
1274
  const failed=data.tests.filter(t=>isFail(t.outcome)), cmd=rerunCmd(failed);
1262
1275
  if(!base&&!cmd) return null;
1263
1276
  const segs=[];
@@ -1276,8 +1289,9 @@ function changesLine(){
1276
1289
  const toggle=(k,ts,btn)=>{ el.querySelectorAll('.seg').forEach(b=>b.setAttribute('aria-expanded','false'));
1277
1290
  if(open===k){ open=null; list.hidden=true; return; }
1278
1291
  open=k; btn.setAttribute('aria-expanded','true'); list.hidden=false; list.innerHTML='';
1279
- list.append(...ts.slice(0,12).map(t=>h('li',{}, h('button',{onclick:()=>select(t.id)}, h('span',{class:'st '+t.outcome}), h('span',{class:'n'},t.title), h('span',{class:'f'},t.file.split('/').pop()+(data.projects.length>1&&t.project?' · '+t.project:''))))));
1280
- if(ts.length>12) list.append(h('li',{class:'more'},'and '+(ts.length-12)+' more'));
1292
+ // every test the number counts: past about 12 rows the list scrolls inside the card
1293
+ list.append(...ts.map(t=>h('li',{}, h('button',{onclick:()=>select(t.id),title:t.title}, h('span',{class:'st '+t.outcome}), h('span',{class:'n'},t.title), h('span',{class:'f'},t.file.split('/').pop()+(data.projects.length>1&&t.project?' · '+t.project:''))))));
1294
+ list.scrollTop=0;
1281
1295
  };
1282
1296
  if(base) el.append(h('span',{class:'lead'},'Since last run', h('small',{},runLabel(base))));
1283
1297
  else el.append(h('span',{class:'lead'}, failed.length+' failed'));
package/dist/template.js CHANGED
@@ -666,9 +666,9 @@ html,body{-webkit-font-smoothing:antialiased}
666
666
  .chg .seg:hover,.chg .seg[aria-expanded=true]{border-bottom-color:currentColor}
667
667
  .chg .seg.nf{color:var(--fail)} .chg .seg.fx{color:var(--pass)} .chg .seg.sf{color:var(--ink)} .chg .seg.sl{color:var(--flaky-ink)} .chg .seg.nt{color:var(--accent-2)}
668
668
  .chg .same{color:var(--ink-3)} .chg .spacer{flex:1}
669
- .chg-list[hidden]{display:none} .chg-list{flex-basis:100%;list-style:none;margin:2px 0 0;padding:8px 0 0;border-top:1px solid var(--line);display:grid;gap:2px}
669
+ .chg-list[hidden]{display:none} .chg-list{flex-basis:100%;min-width:0;max-height:396px;overflow-y:auto;list-style:none;margin:2px 0 0;padding:8px 0 0;border-top:1px solid var(--line);display:grid;grid-template-columns:minmax(0,1fr);gap:2px} .chg-list li{min-width:0}
670
670
  .chg-list button{display:flex;align-items:center;gap:8px;width:100%;text-align:left;padding:4px 6px;border-radius:6px;color:var(--ink);font:inherit;cursor:pointer;min-width:0} .chg-list button:hover{background:var(--surface-2)}
671
- .chg-list .st{width:8px;height:8px;border-radius:50%;flex:none} .chg-list .n{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap} .chg-list .f{margin-left:auto;flex:none;color:var(--ink-3);font-size:12px} .chg-list .more{color:var(--ink-3);font-size:12px;padding:4px 6px}
671
+ .chg-list .st{width:8px;height:8px;border-radius:50%;flex:none} .chg-list .n{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap} .chg-list .f{margin-left:auto;flex:none;max-width:40%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--ink-3);font-size:12px} .chg-list .more{color:var(--ink-3);font-size:12px;padding:4px 6px}
672
672
  .rerun{display:flex;align-items:center;gap:10px;margin:12px 0;padding:5px 5px 5px 12px;background:var(--surface-2);border-radius:6px;min-width:0}
673
673
  .rerun .k{flex:none;font-size:12px;color:var(--ink-3)} .rerun code{flex:1;min-width:0;font:12px var(--mono);color:var(--ink);white-space:nowrap;overflow:hidden;text-overflow:ellipsis} .rerun .btn{flex:none;background:var(--surface)}
674
674
  @media print{.chg,.rerun{display:none}}
@@ -1304,12 +1304,25 @@ function initials(name){ return (name||'').split(/[\s\-–—·]+/).filter(Boole
1304
1304
  function prevRun(){
1305
1305
  const H=data.history||[]; if(H.length<2) return null;
1306
1306
  const cur=H[H.length-1], n=cur.total||0;
1307
- const comparable=e=> isSmallRun(cur) ? (e.total||0)>=n/2 && (e.total||0)<=n*2 : !isSmallRun(e);
1307
+ // a pass rate is only compared with a run of a similar size: never a full run with a debug run of a few specs,
1308
+ // nor a re-run of the failed tests with the full run
1309
+ const comparable=e=> (e.total||0)>=n/2 && (e.total||0)<=n*2;
1308
1310
  let fallback=null;
1309
1311
  for(let i=H.length-2;i>=0;i--){ if(!comparable(H[i])) continue; if(!cur.label||H[i].label!==cur.label) return H[i]; if(!fallback) fallback=H[i]; }
1310
1312
  return fallback;
1311
1313
  }
1312
1314
 
1315
+ /* The run "Since last run" compares with: the latest earlier run that ran at least half of this run's tests. So a
1316
+ full run that follows a debug run of a few specs is compared with the last full run, and a re-run of the failed
1317
+ tests with the run they failed in. History written before per-test results were kept falls back to prevRun(). */
1318
+ function changesBase(){
1319
+ const H=data.history||[]; if(H.length<2) return null;
1320
+ const keys=data.tests.map(t=>t.key); if(!keys.length) return null;
1321
+ if(!H.slice(0,-1).some(e=>e.tests)) return prevRun();
1322
+ for(let i=H.length-2;i>=0;i--){ const e=H[i]; if(!e.tests) continue; let n=0; for(const k of keys) if(e.tests[k]) n++; if(n>=keys.length/2) return e; }
1323
+ return null;
1324
+ }
1325
+
1313
1326
  /* ---------- since last run, and the command to run tests again ---------- */
1314
1327
  /* The command that runs these tests again. The runner gives the shape in data.rerun ({pre, sep, post}) and each test
1315
1328
  its target first, then options it needs (Playwright: file:line, then --project=...). Targets and options are
@@ -1323,7 +1336,7 @@ function rerunCmd(ts){
1323
1336
  /* One line under the cards: what changed against the previous comparable run, each part opens its tests.
1324
1337
  Without history it still offers the command for the failed tests. */
1325
1338
  function changesLine(){
1326
- const p=prevRun(), base=p&&p.tests? p : null;
1339
+ const p=changesBase(), base=p&&p.tests? p : null;
1327
1340
  const failed=data.tests.filter(t=>isFail(t.outcome)), cmd=rerunCmd(failed);
1328
1341
  if(!base&&!cmd) return null;
1329
1342
  const segs=[];
@@ -1342,8 +1355,9 @@ function changesLine(){
1342
1355
  const toggle=(k,ts,btn)=>{ el.querySelectorAll('.seg').forEach(b=>b.setAttribute('aria-expanded','false'));
1343
1356
  if(open===k){ open=null; list.hidden=true; return; }
1344
1357
  open=k; btn.setAttribute('aria-expanded','true'); list.hidden=false; list.innerHTML='';
1345
- list.append(...ts.slice(0,12).map(t=>h('li',{}, h('button',{onclick:()=>select(t.id)}, h('span',{class:'st '+t.outcome}), h('span',{class:'n'},t.title), h('span',{class:'f'},t.file.split('/').pop()+(data.projects.length>1&&t.project?' · '+t.project:''))))));
1346
- if(ts.length>12) list.append(h('li',{class:'more'},'and '+(ts.length-12)+' more'));
1358
+ // every test the number counts: past about 12 rows the list scrolls inside the card
1359
+ list.append(...ts.map(t=>h('li',{}, h('button',{onclick:()=>select(t.id),title:t.title}, h('span',{class:'st '+t.outcome}), h('span',{class:'n'},t.title), h('span',{class:'f'},t.file.split('/').pop()+(data.projects.length>1&&t.project?' · '+t.project:''))))));
1360
+ list.scrollTop=0;
1347
1361
  };
1348
1362
  if(base) el.append(h('span',{class:'lead'},'Since last run', h('small',{},runLabel(base))));
1349
1363
  else el.append(h('span',{class:'lead'}, failed.length+' failed'));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "reporting-labs",
3
- "version": "0.6.24",
3
+ "version": "0.6.25",
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",