@testrelic/maestro-analytics 1.4.3-next.191 → 1.4.3-next.193

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/dist/cli.cjs CHANGED
@@ -1382,8 +1382,8 @@ function discoverFlowFiles(dir) {
1382
1382
  var import_node_fs8 = require("fs");
1383
1383
  var import_node_path7 = require("path");
1384
1384
  var import_node_fs9 = require("fs");
1385
- var LOG_LINE_REGEX = /^(\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:?\d{2})?)\s+\[?\s*(\w+)\s*\]?\s+(.+)$/;
1386
- var TIMESTAMP_ONLY_REGEX = /^\[?(\d{2}:\d{2}:\d{2}(?:\.\d+)?)\]?\s+\[?\s*(\w+)\s*\]?\s+(.+)$/;
1385
+ var LOG_LINE_REGEX = /^(\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:?\d{2})?)\s+(?:\[\s*)?(\w+)(?:\s*\])?\s+(\S.*)$/;
1386
+ var TIMESTAMP_ONLY_REGEX = /^\[?(\d{2}:\d{2}:\d{2}(?:\.\d+)?)\]?\s+(?:\[\s*)?(\w+)(?:\s*\])?\s+(\S.*)$/;
1387
1387
  function parseLevel(raw) {
1388
1388
  const upper = raw.toUpperCase();
1389
1389
  if (upper === "DEBUG" || upper === "TRACE" || upper === "VERBOSE") return "DEBUG";
@@ -1507,15 +1507,29 @@ function classifySeverity(text) {
1507
1507
  return "info";
1508
1508
  }
1509
1509
  function stripHtmlTags(html) {
1510
- return html.replace(/<[^>]*>/g, " ").replace(/\s+/g, " ").trim();
1510
+ return html.replace(/<[^<>]*>/g, " ").replace(/\s+/g, " ").trim();
1511
+ }
1512
+ function tagBlocks(html, tag) {
1513
+ const open = new RegExp(`<${tag}`, "gi");
1514
+ const close = new RegExp(`</${tag}>`, "gi");
1515
+ const blocks = [];
1516
+ for (; ; ) {
1517
+ const start = open.exec(html);
1518
+ if (!start) break;
1519
+ const gt = html.indexOf(">", start.index + start[0].length);
1520
+ if (gt === -1) break;
1521
+ close.lastIndex = gt + 1;
1522
+ const end = close.exec(html);
1523
+ if (!end) break;
1524
+ blocks.push(html.slice(gt + 1, end.index));
1525
+ open.lastIndex = end.index + end[0].length;
1526
+ }
1527
+ return blocks;
1511
1528
  }
1512
1529
  function extractDefectsFromHtml(html) {
1513
1530
  const defects = [];
1514
1531
  const plainText = stripHtmlTags(html);
1515
- const listItemRegex = /<li[^>]*>([\s\S]*?)<\/li>/gi;
1516
- let match;
1517
- while ((match = listItemRegex.exec(html)) !== null) {
1518
- const itemHtml = match[1];
1532
+ for (const itemHtml of tagBlocks(html, "li")) {
1519
1533
  const itemText = stripHtmlTags(itemHtml);
1520
1534
  if (!itemText || itemText.length < 5) continue;
1521
1535
  if (DEFECT_SECTION_REGEX.test(itemText) || UI_DEFECT_REGEX.test(itemText) || SPELLING_REGEX.test(itemText) || I18N_REGEX.test(itemText)) {
@@ -1529,9 +1543,8 @@ function extractDefectsFromHtml(html) {
1529
1543
  }
1530
1544
  }
1531
1545
  if (defects.length === 0) {
1532
- const paragraphRegex = /<p[^>]*>([\s\S]*?)<\/p>/gi;
1533
- while ((match = paragraphRegex.exec(html)) !== null) {
1534
- const pText = stripHtmlTags(match[1]);
1546
+ for (const pHtml of tagBlocks(html, "p")) {
1547
+ const pText = stripHtmlTags(pHtml);
1535
1548
  if (!pText || pText.length < 10) continue;
1536
1549
  if (UI_DEFECT_REGEX.test(pText) || SPELLING_REGEX.test(pText) || I18N_REGEX.test(pText) || LAYOUT_REGEX.test(pText) || A11Y_REGEX.test(pText)) {
1537
1550
  defects.push({
@@ -2693,7 +2706,7 @@ function renderRunMeta(){
2693
2706
  var h='';
2694
2707
  h+='<span class="run-meta-item"><span class="run-meta-label">Run</span><span class="run-id-tag">'+esc((report.testRunId||'').substring(0,12))+'</span></span>';
2695
2708
  h+='<span class="run-meta-item"><span class="run-meta-label">Duration</span>'+fmtDur(report.totalDuration)+'</span>';
2696
- h+='<span class="run-meta-item">'+fmtDate(report.startedAt)+'</span>';
2709
+ h+='<span class="run-meta-item">'+esc(fmtDate(report.startedAt))+'</span>';
2697
2710
  if(report.ci){
2698
2711
  h+='<span class="run-meta-item"><span class="ci-tag">'+esc(report.ci.provider)+'</span></span>';
2699
2712
  if(report.ci.branch)h+='<span class="run-meta-item"><span class="run-meta-label">Branch</span>'+esc(report.ci.branch)+'</span>';
@@ -2726,7 +2739,7 @@ function renderHeroStrip(){
2726
2739
  ];
2727
2740
  chips.forEach(function(c){
2728
2741
  h+='<div class="summary-chip '+c.cls+'" data-filter="'+(c.f||'')+'">'
2729
- +'<div class="s-count">'+c.n+'</div>'
2742
+ +'<div class="s-count">'+Number(c.n)+'</div>'
2730
2743
  +'<div class="s-label">'+c.l+'</div></div>';
2731
2744
  });
2732
2745
  h+='</div></div>';
@@ -2735,8 +2748,8 @@ function renderHeroStrip(){
2735
2748
  h+='<span>Total Duration: <strong>'+fmtDur(report.totalDuration)+'</strong></span>';
2736
2749
  var plat=detectPlatform();
2737
2750
  if(plat)h+='<span>Platform: <strong>'+esc(plat)+'</strong></span>';
2738
- if(summary.totalActionSteps)h+='<span>Steps: <strong>'+summary.totalActionSteps+'</strong></span>';
2739
- if(summary.totalAssertions)h+='<span>Assertions: <strong>'+summary.totalAssertions+'</strong></span>';
2751
+ if(summary.totalActionSteps)h+='<span>Steps: <strong>'+Number(summary.totalActionSteps)+'</strong></span>';
2752
+ if(summary.totalAssertions)h+='<span>Assertions: <strong>'+Number(summary.totalAssertions)+'</strong></span>';
2740
2753
  h+='</div>';
2741
2754
 
2742
2755
  el.innerHTML=h;
@@ -4188,8 +4201,8 @@ function openInBrowser(filePath) {
4188
4201
  file = "open";
4189
4202
  args = [filePath];
4190
4203
  } else if (platform === "win32") {
4191
- file = "cmd";
4192
- args = ["/c", "start", "", filePath];
4204
+ file = "explorer.exe";
4205
+ args = [filePath];
4193
4206
  } else {
4194
4207
  file = "xdg-open";
4195
4208
  args = [filePath];
@@ -4417,13 +4430,18 @@ function getRemoteUrl(cwd) {
4417
4430
  if (!firstRemote) return null;
4418
4431
  return execGit(`git remote get-url ${firstRemote}`, cwd);
4419
4432
  }
4433
+ function trimTrailingSlashes(s) {
4434
+ let end = s.length;
4435
+ while (end > 0 && s.charCodeAt(end - 1) === 47) end--;
4436
+ return s.slice(0, end);
4437
+ }
4420
4438
  function normalizeGitRemoteUrl(url) {
4421
4439
  let normalized = url.trim();
4422
4440
  normalized = normalized.replace(/^[a-z+]+:\/\//, "");
4423
4441
  normalized = normalized.replace(/^[^@]+@/, "");
4424
4442
  normalized = normalized.replace(/:(?!\d)/, "/");
4425
4443
  normalized = normalized.replace(/\.git$/, "");
4426
- normalized = normalized.replace(/\/+$/, "");
4444
+ normalized = trimTrailingSlashes(normalized);
4427
4445
  normalized = normalized.replace(/^[^@/]+@/, "");
4428
4446
  return normalized.toLowerCase();
4429
4447
  }