tolkira 0.2.0 → 0.3.0
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/GLOSSARY.md +93 -0
- package/README.md +207 -15
- package/SECURITY.md +3 -0
- package/dist/cli.js +1455 -579
- package/dist/cli.js.map +4 -4
- package/dist/compat/cucumber-html-reporter.cjs +12 -0
- package/dist/compat/cucumber-html-reporter.d.cts +10 -0
- package/dist/compat/cucumber-html-reporter.js +95 -24
- package/dist/compat/cucumber-html-reporter.js.map +4 -4
- package/dist/compat/options.d.ts +2 -0
- package/dist/index.d.ts +4 -7
- package/dist/index.js +1449 -552
- package/dist/index.js.map +4 -4
- package/dist/input/background.d.ts +4 -0
- package/dist/input/load.d.ts +2 -0
- package/dist/options.d.ts +12 -0
- package/dist/output.d.ts +2 -0
- package/dist/render/ansi.d.ts +2 -0
- package/dist/render/client-bundle.d.ts +1 -0
- package/dist/render/markdown.d.ts +1 -0
- package/dist/render/search.d.ts +18 -0
- package/dist/report/attachment.d.ts +10 -0
- package/dist/report/model.d.ts +85 -4
- package/dist/report/status.d.ts +12 -0
- package/dist/stream.d.ts +15 -0
- package/dist/summary.d.ts +14 -2
- package/dist/text.d.ts +15 -0
- package/docs/AGENT-INTERFACE.md +158 -21
- package/docs/COMPATIBILITY.md +51 -7
- package/docs/CUCUMBER-COMPATIBILITY.md +193 -0
- package/docs/JUNIT-XML.md +27 -2
- package/docs/LIMITATIONS.md +17 -0
- package/llms.txt +31 -0
- package/package.json +30 -8
package/dist/index.js
CHANGED
|
@@ -9,6 +9,17 @@ import {
|
|
|
9
9
|
HookType,
|
|
10
10
|
TestStepResultStatus
|
|
11
11
|
} from "@cucumber/messages";
|
|
12
|
+
|
|
13
|
+
// src/input/background.ts
|
|
14
|
+
var synthetic = /* @__PURE__ */ new WeakSet();
|
|
15
|
+
function markSyntheticBackground(background) {
|
|
16
|
+
synthetic.add(background);
|
|
17
|
+
}
|
|
18
|
+
function isSyntheticBackground(background) {
|
|
19
|
+
return synthetic.has(background);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// src/input/legacy.ts
|
|
12
23
|
function isRecord(value) {
|
|
13
24
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
14
25
|
}
|
|
@@ -329,26 +340,10 @@ function resultOf(legacyStep, scale = 1) {
|
|
|
329
340
|
}
|
|
330
341
|
return result;
|
|
331
342
|
}
|
|
332
|
-
var MIME_EXTENSIONS = {
|
|
333
|
-
"application/json": "json",
|
|
334
|
-
"application/octet-stream": "bin",
|
|
335
|
-
"image/gif": "gif",
|
|
336
|
-
"image/jpeg": "jpg",
|
|
337
|
-
"image/png": "png",
|
|
338
|
-
"image/svg+xml": "svg",
|
|
339
|
-
"text/html": "html",
|
|
340
|
-
"text/plain": "txt",
|
|
341
|
-
"video/mp4": "mp4",
|
|
342
|
-
"video/webm": "webm"
|
|
343
|
-
};
|
|
344
343
|
function isLikelyBase64(value) {
|
|
345
344
|
const compact = value.replace(/\s/g, "");
|
|
346
345
|
return compact.length > 0 && compact.length % 4 === 0 && /^[A-Za-z0-9+/]*={0,2}$/.test(compact);
|
|
347
346
|
}
|
|
348
|
-
function attachmentFileName(mediaType, index) {
|
|
349
|
-
const extension = MIME_EXTENSIONS[mediaType.toLowerCase()] ?? mediaType.split("/")[1]?.split(";")[0]?.trim() ?? "bin";
|
|
350
|
-
return `attachment-${index + 1}.${extension}`;
|
|
351
|
-
}
|
|
352
347
|
function parseLegacyJson(content, source, options = {}) {
|
|
353
348
|
let parsed;
|
|
354
349
|
try {
|
|
@@ -370,7 +365,6 @@ function parseLegacyValue(parsed, source, options = {}) {
|
|
|
370
365
|
const runId = nextId("run");
|
|
371
366
|
const envelopes = [];
|
|
372
367
|
const statuses = [];
|
|
373
|
-
let attachmentCounter = 0;
|
|
374
368
|
const meta = {
|
|
375
369
|
protocolVersion: "",
|
|
376
370
|
implementation: { name: "tolkira-legacy-json" },
|
|
@@ -415,14 +409,18 @@ function parseLegacyValue(parsed, source, options = {}) {
|
|
|
415
409
|
description: normalizeText(backgroundElement.description),
|
|
416
410
|
steps: backgroundNodes
|
|
417
411
|
};
|
|
412
|
+
markSyntheticBackground(background);
|
|
418
413
|
featureChildren.push({ background });
|
|
419
414
|
}
|
|
420
415
|
const scenarios = (legacyFeature.elements ?? []).filter(
|
|
421
416
|
(element) => !isBackgroundElement(element)
|
|
422
417
|
);
|
|
418
|
+
const featureTagNames = new Set(featureTags.map((tag) => tag.name));
|
|
423
419
|
for (const [scenarioIndex, element] of scenarios.entries()) {
|
|
424
420
|
const scenarioId = nextId("scenario");
|
|
425
|
-
const scenarioTags2 = mapTags(element.tags, nextId)
|
|
421
|
+
const scenarioTags2 = mapTags(element.tags, nextId).filter(
|
|
422
|
+
(tag) => !featureTagNames.has(tag.name)
|
|
423
|
+
);
|
|
426
424
|
const scenarioSteps = (element.steps ?? []).filter((step) => !isHook(step));
|
|
427
425
|
const stepNodes = scenarioSteps.map((step) => mapStep(step, nextId));
|
|
428
426
|
const backgroundInline = backgroundSteps.length > 0 && backgroundSteps.every(
|
|
@@ -567,7 +565,6 @@ function parseLegacyValue(parsed, source, options = {}) {
|
|
|
567
565
|
body: embedding.data,
|
|
568
566
|
contentEncoding: isLikelyBase64(embedding.data) ? AttachmentContentEncoding.BASE64 : AttachmentContentEncoding.IDENTITY,
|
|
569
567
|
mediaType,
|
|
570
|
-
fileName: attachmentFileName(mediaType, attachmentCounter++),
|
|
571
568
|
testCaseStartedId,
|
|
572
569
|
testStepId: plan.testStep.id,
|
|
573
570
|
timestamp: finishedAt
|
|
@@ -678,12 +675,12 @@ function secondsToNanoseconds(value) {
|
|
|
678
675
|
function isXmlChar(code) {
|
|
679
676
|
return code === 9 || code === 10 || code === 13 || code >= 32 && code <= 55295 || code >= 57344 && code <= 65533 || code >= 65536 && code <= 1114111;
|
|
680
677
|
}
|
|
681
|
-
function checkEntityReferences(fragment, source
|
|
678
|
+
function checkEntityReferences(fragment, source) {
|
|
682
679
|
const entityPattern = /&([^;]{1,32});/g;
|
|
683
680
|
let match;
|
|
684
681
|
while ((match = entityPattern.exec(fragment)) !== null) {
|
|
685
682
|
const entity = match[1];
|
|
686
|
-
if (entity === "amp" || entity === "lt" || entity === "gt" || entity === "quot" || entity === "apos"
|
|
683
|
+
if (entity === "amp" || entity === "lt" || entity === "gt" || entity === "quot" || entity === "apos") {
|
|
687
684
|
continue;
|
|
688
685
|
}
|
|
689
686
|
let code;
|
|
@@ -699,8 +696,7 @@ function checkEntityReferences(fragment, source, allowedNames) {
|
|
|
699
696
|
}
|
|
700
697
|
}
|
|
701
698
|
}
|
|
702
|
-
function
|
|
703
|
-
const allowedNames = /* @__PURE__ */ new Set();
|
|
699
|
+
function assertSafeMarkup(content, source) {
|
|
704
700
|
const scanTag = (start) => {
|
|
705
701
|
let index2 = start + 1;
|
|
706
702
|
let quote = "";
|
|
@@ -709,11 +705,7 @@ function assertValidEntities(content, source) {
|
|
|
709
705
|
const char = content[index2];
|
|
710
706
|
if (quote) {
|
|
711
707
|
if (char === quote) {
|
|
712
|
-
checkEntityReferences(
|
|
713
|
-
content.slice(valueStart, index2),
|
|
714
|
-
source,
|
|
715
|
-
allowedNames
|
|
716
|
-
);
|
|
708
|
+
checkEntityReferences(content.slice(valueStart, index2), source);
|
|
717
709
|
quote = "";
|
|
718
710
|
}
|
|
719
711
|
} else if (char === '"' || char === "'") {
|
|
@@ -726,47 +718,15 @@ function assertValidEntities(content, source) {
|
|
|
726
718
|
}
|
|
727
719
|
return index2;
|
|
728
720
|
};
|
|
729
|
-
const scanDoctype = (start) => {
|
|
730
|
-
let index2 = start + "<!DOCTYPE".length;
|
|
731
|
-
let quote = "";
|
|
732
|
-
let depth = 0;
|
|
733
|
-
while (index2 < content.length) {
|
|
734
|
-
const char = content[index2];
|
|
735
|
-
if (quote) {
|
|
736
|
-
if (char === quote) quote = "";
|
|
737
|
-
} else if (char === '"' || char === "'") {
|
|
738
|
-
quote = char;
|
|
739
|
-
} else if (char === "[") {
|
|
740
|
-
depth += 1;
|
|
741
|
-
} else if (char === "]") {
|
|
742
|
-
depth -= 1;
|
|
743
|
-
} else if (char === ">" && depth <= 0) {
|
|
744
|
-
const doctype = content.slice(start, index2 + 1);
|
|
745
|
-
for (const entity of doctype.matchAll(
|
|
746
|
-
/<!ENTITY\s+([A-Za-z_:][\w.:-]*)/g
|
|
747
|
-
)) {
|
|
748
|
-
const name = entity[1];
|
|
749
|
-
if (name) allowedNames.add(name);
|
|
750
|
-
}
|
|
751
|
-
return index2 + 1;
|
|
752
|
-
}
|
|
753
|
-
index2 += 1;
|
|
754
|
-
}
|
|
755
|
-
return index2;
|
|
756
|
-
};
|
|
757
721
|
let index = 0;
|
|
758
722
|
while (index < content.length) {
|
|
759
723
|
const start = content.indexOf("<", index);
|
|
760
724
|
if (start === -1) {
|
|
761
|
-
checkEntityReferences(content.slice(index), source
|
|
725
|
+
checkEntityReferences(content.slice(index), source);
|
|
762
726
|
return;
|
|
763
727
|
}
|
|
764
728
|
if (start > index) {
|
|
765
|
-
checkEntityReferences(
|
|
766
|
-
content.slice(index, start),
|
|
767
|
-
source,
|
|
768
|
-
allowedNames
|
|
769
|
-
);
|
|
729
|
+
checkEntityReferences(content.slice(index, start), source);
|
|
770
730
|
}
|
|
771
731
|
if (content.startsWith("<!--", start)) {
|
|
772
732
|
const end = content.indexOf("-->", start + 4);
|
|
@@ -777,9 +737,15 @@ function assertValidEntities(content, source) {
|
|
|
777
737
|
} else if (content.startsWith("<?", start)) {
|
|
778
738
|
const end = content.indexOf("?>", start + 2);
|
|
779
739
|
index = end === -1 ? content.length : end + 2;
|
|
780
|
-
} else if (content.startsWith("<!DOCTYPE", start)) {
|
|
781
|
-
index = scanDoctype(start);
|
|
782
740
|
} else if (content.startsWith("<!", start)) {
|
|
741
|
+
const declaration = /^<!(DOCTYPE|ENTITY)\b/i.exec(
|
|
742
|
+
content.slice(start, start + 10)
|
|
743
|
+
);
|
|
744
|
+
if (declaration) {
|
|
745
|
+
throw new Error(
|
|
746
|
+
`Invalid JUnit XML in ${source}: <!${declaration[1].toUpperCase()}> declarations are not supported.`
|
|
747
|
+
);
|
|
748
|
+
}
|
|
783
749
|
const end = content.indexOf(">", start + 2);
|
|
784
750
|
index = end === -1 ? content.length : end + 1;
|
|
785
751
|
} else {
|
|
@@ -832,6 +798,7 @@ function elementFromTestcase(testcase, index) {
|
|
|
832
798
|
const skipped = asArray(testcase.skipped).length > 0;
|
|
833
799
|
const status = hasFailure ? "failed" : skipped ? "skipped" : "passed";
|
|
834
800
|
const name = stringOf(testcase.name) || stringOf(testcase.classname) || `Test ${index + 1}`;
|
|
801
|
+
const description = stringOf(testcase.description);
|
|
835
802
|
const result = {
|
|
836
803
|
status,
|
|
837
804
|
duration: secondsToNanoseconds(testcase.time)
|
|
@@ -860,6 +827,7 @@ function elementFromTestcase(testcase, index) {
|
|
|
860
827
|
type: "scenario",
|
|
861
828
|
keyword: "Scenario",
|
|
862
829
|
name,
|
|
830
|
+
description,
|
|
863
831
|
line: 1,
|
|
864
832
|
tags: [],
|
|
865
833
|
steps: [step]
|
|
@@ -871,6 +839,7 @@ function featureFromSuite(suite, source, index) {
|
|
|
871
839
|
return {
|
|
872
840
|
keyword: "Feature",
|
|
873
841
|
name,
|
|
842
|
+
description: stringOf(suite.description),
|
|
874
843
|
uri: source,
|
|
875
844
|
line: 1,
|
|
876
845
|
tags: [],
|
|
@@ -885,7 +854,7 @@ function looksLikeJUnit(content) {
|
|
|
885
854
|
}
|
|
886
855
|
async function parseJUnitXml(content, source, options = {}) {
|
|
887
856
|
const { XMLParser, XMLValidator } = await import("fast-xml-parser");
|
|
888
|
-
|
|
857
|
+
assertSafeMarkup(content, source);
|
|
889
858
|
const validation = XMLValidator.validate(content);
|
|
890
859
|
if (validation !== true) {
|
|
891
860
|
const line = Number.isFinite(validation.err.line) ? validation.err.line : 1;
|
|
@@ -1148,6 +1117,14 @@ function parseMessages(content, source) {
|
|
|
1148
1117
|
// src/input/load.ts
|
|
1149
1118
|
var MESSAGES_EXTENSIONS = /* @__PURE__ */ new Set([".jsonl", ".ndjson"]);
|
|
1150
1119
|
var MAX_TOTAL_INPUT_BYTES = 100 * 1024 * 1024;
|
|
1120
|
+
function addInputBytes(totalBytes, size) {
|
|
1121
|
+
if (totalBytes + size > MAX_TOTAL_INPUT_BYTES) {
|
|
1122
|
+
throw new Error(
|
|
1123
|
+
"Inputs exceed 100 MB in total. Split the report or use external attachments."
|
|
1124
|
+
);
|
|
1125
|
+
}
|
|
1126
|
+
return totalBytes + size;
|
|
1127
|
+
}
|
|
1151
1128
|
function isObject3(value) {
|
|
1152
1129
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
1153
1130
|
}
|
|
@@ -1242,16 +1219,12 @@ async function loadInputs(inputs) {
|
|
|
1242
1219
|
let totalBytes = 0;
|
|
1243
1220
|
for (const [index, input] of ordered.entries()) {
|
|
1244
1221
|
const info = await stat(input.file);
|
|
1245
|
-
|
|
1246
|
-
throw new Error(
|
|
1247
|
-
"Inputs exceed 100 MB in total. Split the report or use external attachments."
|
|
1248
|
-
);
|
|
1249
|
-
}
|
|
1222
|
+
const nextTotal = addInputBytes(totalBytes, info.size);
|
|
1250
1223
|
const content = await readFile(input.file, "utf8");
|
|
1251
1224
|
const hash = createHash("sha256").update(content).digest("hex");
|
|
1252
1225
|
if (seenContent.has(hash)) continue;
|
|
1253
1226
|
seenContent.add(hash);
|
|
1254
|
-
totalBytes
|
|
1227
|
+
totalBytes = nextTotal;
|
|
1255
1228
|
const extension = path2.extname(input.file).toLowerCase();
|
|
1256
1229
|
const legacy = sniffLegacy(content);
|
|
1257
1230
|
let parsed = [];
|
|
@@ -1355,19 +1328,28 @@ function provenanceFor(groups) {
|
|
|
1355
1328
|
return provenance;
|
|
1356
1329
|
}
|
|
1357
1330
|
|
|
1331
|
+
// src/options.ts
|
|
1332
|
+
function renderOptions(options) {
|
|
1333
|
+
return {
|
|
1334
|
+
title: options.title ?? "Tolkira report",
|
|
1335
|
+
metadata: options.metadata,
|
|
1336
|
+
logo: options.logo,
|
|
1337
|
+
accent: options.accent
|
|
1338
|
+
};
|
|
1339
|
+
}
|
|
1340
|
+
|
|
1358
1341
|
// src/render/html.ts
|
|
1359
1342
|
import { createHash as createHash2 } from "node:crypto";
|
|
1360
1343
|
|
|
1361
1344
|
// src/input/sanitize.ts
|
|
1362
1345
|
var REMOTE_MARKDOWN_IMAGE = /!\[([^\]]*)\]\(\s*(?:https?:)?\/\/[^)\s]+(?:\s+["'][^"']*["'])?\s*\)/gi;
|
|
1363
1346
|
var REMOTE_ANGLE_IMAGE = /!\[([^\]]*)\]\(\s*<(?:https?:)?\/\/[^>]+>\s*\)/gi;
|
|
1364
|
-
var REMOTE_REFERENCE_DEFINITION = /^\s*\[[^\]]+\]:\s*(?:https?:)?\/\/\S+.*$/gim;
|
|
1365
1347
|
var RAW_IMAGE_TAG = /<img\b[^>]*>/gi;
|
|
1366
1348
|
var MAX_ATTACHMENT_BYTES = 50 * 1024 * 1024;
|
|
1367
1349
|
var MAX_TOTAL_ATTACHMENT_BYTES = 100 * 1024 * 1024;
|
|
1368
1350
|
function stripRemoteImages(value) {
|
|
1369
1351
|
if (typeof value !== "string") return "";
|
|
1370
|
-
return value.replace(REMOTE_ANGLE_IMAGE, "$1").replace(REMOTE_MARKDOWN_IMAGE, "$1
|
|
1352
|
+
return value.replace(REMOTE_ANGLE_IMAGE, "![$1]()").replace(REMOTE_MARKDOWN_IMAGE, "![$1]()").replace(RAW_IMAGE_TAG, "");
|
|
1371
1353
|
}
|
|
1372
1354
|
function base64Bytes(value) {
|
|
1373
1355
|
const padding = value.endsWith("==") ? 2 : value.endsWith("=") ? 1 : 0;
|
|
@@ -1436,11 +1418,35 @@ function sanitizeEnvelopes(envelopes) {
|
|
|
1436
1418
|
return envelopes;
|
|
1437
1419
|
}
|
|
1438
1420
|
|
|
1421
|
+
// src/report/attachment.ts
|
|
1422
|
+
var MAX_TEXT_ATTACHMENT_BYTES = 262144;
|
|
1423
|
+
var MEDIA_EXTENSIONS = {
|
|
1424
|
+
"application/json": "json",
|
|
1425
|
+
"application/octet-stream": "bin",
|
|
1426
|
+
"image/gif": "gif",
|
|
1427
|
+
"image/jpeg": "jpg",
|
|
1428
|
+
"image/png": "png",
|
|
1429
|
+
"image/svg+xml": "svg",
|
|
1430
|
+
"image/webp": "webp",
|
|
1431
|
+
"text/csv": "csv",
|
|
1432
|
+
"text/html": "html",
|
|
1433
|
+
"text/plain": "txt",
|
|
1434
|
+
"text/uri-list": "txt",
|
|
1435
|
+
"text/x.cucumber.log+plain": "log",
|
|
1436
|
+
"video/mp4": "mp4",
|
|
1437
|
+
"video/webm": "webm"
|
|
1438
|
+
};
|
|
1439
|
+
function normalizedMediaType(mediaType) {
|
|
1440
|
+
return mediaType.split(";")[0]?.trim().toLowerCase() ?? "";
|
|
1441
|
+
}
|
|
1442
|
+
var SAFE_MEDIA_TYPES = new Set(Object.keys(MEDIA_EXTENSIONS));
|
|
1443
|
+
function safeMediaType(mediaType) {
|
|
1444
|
+
const base = normalizedMediaType(mediaType || "");
|
|
1445
|
+
return SAFE_MEDIA_TYPES.has(base) ? base : "application/octet-stream";
|
|
1446
|
+
}
|
|
1447
|
+
|
|
1439
1448
|
// src/report/model.ts
|
|
1440
|
-
import {
|
|
1441
|
-
getWorstTestStepResult,
|
|
1442
|
-
TestStepResultStatus as TestStepResultStatus3
|
|
1443
|
-
} from "@cucumber/messages";
|
|
1449
|
+
import { getWorstTestStepResult } from "@cucumber/messages";
|
|
1444
1450
|
|
|
1445
1451
|
// src/result-message.ts
|
|
1446
1452
|
function stepResultMessage(result) {
|
|
@@ -1453,7 +1459,89 @@ ${message}`;
|
|
|
1453
1459
|
return message || exception || void 0;
|
|
1454
1460
|
}
|
|
1455
1461
|
|
|
1456
|
-
// src/
|
|
1462
|
+
// src/text.ts
|
|
1463
|
+
var BIDI_CONTROLS = /[\u202A-\u202E\u2066-\u2069]/g;
|
|
1464
|
+
var ANSI_CONTROLS = /[\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F-\u009F]/;
|
|
1465
|
+
var STRING_INTRODUCERS = /* @__PURE__ */ new Set([144, 152, 157, 158, 159]);
|
|
1466
|
+
function stripBidiControls(value) {
|
|
1467
|
+
return value.replace(BIDI_CONTROLS, "");
|
|
1468
|
+
}
|
|
1469
|
+
function csiEnd(text, start) {
|
|
1470
|
+
let index = start + 1;
|
|
1471
|
+
while (index < text.length && text.charCodeAt(index) >= 48 && text.charCodeAt(index) <= 63) {
|
|
1472
|
+
index += 1;
|
|
1473
|
+
}
|
|
1474
|
+
while (index < text.length && text.charCodeAt(index) >= 32 && text.charCodeAt(index) <= 47) {
|
|
1475
|
+
index += 1;
|
|
1476
|
+
}
|
|
1477
|
+
return index < text.length ? index + 1 : index;
|
|
1478
|
+
}
|
|
1479
|
+
function stringEnd(text, start, allowBel) {
|
|
1480
|
+
let end = start;
|
|
1481
|
+
while (end < text.length) {
|
|
1482
|
+
if (allowBel && text[end] === "\x07") return end + 1;
|
|
1483
|
+
if (text[end] === "\x9C") return end + 1;
|
|
1484
|
+
if (text[end] === "\x1B" && text[end + 1] === "\\") return end + 2;
|
|
1485
|
+
end += 1;
|
|
1486
|
+
}
|
|
1487
|
+
return void 0;
|
|
1488
|
+
}
|
|
1489
|
+
function isEscapeIntroducer(code) {
|
|
1490
|
+
return code === 27 || code === 155 || STRING_INTRODUCERS.has(code);
|
|
1491
|
+
}
|
|
1492
|
+
function scanEscape(text, start) {
|
|
1493
|
+
const first = text.charCodeAt(start);
|
|
1494
|
+
if (first === 155) {
|
|
1495
|
+
const end2 = csiEnd(text, start);
|
|
1496
|
+
const final = end2 > start + 1 ? text[end2 - 1] : "";
|
|
1497
|
+
return final === "m" ? { end: end2, sgr: text.slice(start + 1, end2 - 1) } : { end: end2 };
|
|
1498
|
+
}
|
|
1499
|
+
if (STRING_INTRODUCERS.has(first)) {
|
|
1500
|
+
return {
|
|
1501
|
+
end: stringEnd(text, start + 1, first === 157) ?? start + 1
|
|
1502
|
+
};
|
|
1503
|
+
}
|
|
1504
|
+
let index = start + 1;
|
|
1505
|
+
if (index >= text.length) return { end: index };
|
|
1506
|
+
const introducer = text[index];
|
|
1507
|
+
if (introducer === "[") {
|
|
1508
|
+
const end2 = csiEnd(text, index);
|
|
1509
|
+
const final = end2 > index + 1 ? text[end2 - 1] : "";
|
|
1510
|
+
return final === "m" ? { end: end2, sgr: text.slice(index + 1, end2 - 1) } : { end: end2 };
|
|
1511
|
+
}
|
|
1512
|
+
if (introducer === "]" || introducer === "P" || introducer === "_" || introducer === "^" || introducer === "X") {
|
|
1513
|
+
return { end: stringEnd(text, index + 1, introducer === "]") ?? text.length };
|
|
1514
|
+
}
|
|
1515
|
+
let end = index;
|
|
1516
|
+
while (end < text.length && text.charCodeAt(end) >= 32 && text.charCodeAt(end) <= 47) {
|
|
1517
|
+
end += 1;
|
|
1518
|
+
}
|
|
1519
|
+
if (end < text.length && text.charCodeAt(end) >= 48 && text.charCodeAt(end) <= 126) {
|
|
1520
|
+
end += 1;
|
|
1521
|
+
}
|
|
1522
|
+
return { end };
|
|
1523
|
+
}
|
|
1524
|
+
function isControl(code) {
|
|
1525
|
+
return code === 127 || code >= 128 && code <= 159 || code < 32 && code !== 9 && code !== 10;
|
|
1526
|
+
}
|
|
1527
|
+
function stripAnsi(text) {
|
|
1528
|
+
if (!ANSI_CONTROLS.test(text)) return text;
|
|
1529
|
+
let output = "";
|
|
1530
|
+
let chunkStart = 0;
|
|
1531
|
+
for (let index = 0; index < text.length; index += 1) {
|
|
1532
|
+
const code = text.charCodeAt(index);
|
|
1533
|
+
const escape = isEscapeIntroducer(code);
|
|
1534
|
+
if (escape || isControl(code)) {
|
|
1535
|
+
if (index > chunkStart) output += text.slice(chunkStart, index);
|
|
1536
|
+
if (escape) index = scanEscape(text, index).end - 1;
|
|
1537
|
+
chunkStart = index + 1;
|
|
1538
|
+
}
|
|
1539
|
+
}
|
|
1540
|
+
return output + text.slice(chunkStart);
|
|
1541
|
+
}
|
|
1542
|
+
|
|
1543
|
+
// src/report/status.ts
|
|
1544
|
+
import { TestStepResultStatus as TestStepResultStatus3 } from "@cucumber/messages";
|
|
1457
1545
|
var STATUS_ORDER = [
|
|
1458
1546
|
TestStepResultStatus3.UNKNOWN,
|
|
1459
1547
|
TestStepResultStatus3.PASSED,
|
|
@@ -1466,6 +1554,22 @@ var STATUS_ORDER = [
|
|
|
1466
1554
|
function statusSeverity(status) {
|
|
1467
1555
|
return STATUS_ORDER.indexOf(status.toUpperCase());
|
|
1468
1556
|
}
|
|
1557
|
+
function worstExecutedStatus(scenarios) {
|
|
1558
|
+
const executed = scenarios.filter((scenario) => scenario.executed);
|
|
1559
|
+
if (executed.length === 0) return "unknown";
|
|
1560
|
+
let worst = "unknown";
|
|
1561
|
+
let hasNonPassed = false;
|
|
1562
|
+
for (const scenario of executed) {
|
|
1563
|
+
if (scenario.status === "passed") continue;
|
|
1564
|
+
hasNonPassed = true;
|
|
1565
|
+
if (statusSeverity(scenario.status) > statusSeverity(worst)) {
|
|
1566
|
+
worst = scenario.status;
|
|
1567
|
+
}
|
|
1568
|
+
}
|
|
1569
|
+
return hasNonPassed ? worst : "passed";
|
|
1570
|
+
}
|
|
1571
|
+
|
|
1572
|
+
// src/report/model.ts
|
|
1469
1573
|
var VALID_STATUS = /* @__PURE__ */ new Set([
|
|
1470
1574
|
"passed",
|
|
1471
1575
|
"failed",
|
|
@@ -1508,60 +1612,67 @@ function productLabel(product) {
|
|
|
1508
1612
|
const label = [product.name, product.version].filter(Boolean).join(" ");
|
|
1509
1613
|
return label || void 0;
|
|
1510
1614
|
}
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
function
|
|
1516
|
-
|
|
1615
|
+
function nonEmpty(value) {
|
|
1616
|
+
const trimmed = stripBidiControls(value ?? "").trim();
|
|
1617
|
+
return trimmed ? trimmed : void 0;
|
|
1618
|
+
}
|
|
1619
|
+
function ciFromMeta(ci) {
|
|
1620
|
+
if (!ci) return void 0;
|
|
1621
|
+
const git = ci.git;
|
|
1622
|
+
const name = nonEmpty(ci.name);
|
|
1623
|
+
const url = nonEmpty(ci.url);
|
|
1624
|
+
const remote = nonEmpty(git?.remote);
|
|
1625
|
+
const revision = nonEmpty(git?.revision);
|
|
1626
|
+
const branch = nonEmpty(git?.branch);
|
|
1627
|
+
const tag = nonEmpty(git?.tag);
|
|
1628
|
+
const result = {
|
|
1629
|
+
...name ? { name } : {},
|
|
1630
|
+
...url ? { url } : {},
|
|
1631
|
+
...remote ? { remote } : {},
|
|
1632
|
+
...revision ? { revision } : {},
|
|
1633
|
+
...branch ? { branch } : {},
|
|
1634
|
+
...tag ? { tag } : {}
|
|
1635
|
+
};
|
|
1636
|
+
return Object.keys(result).length > 0 ? result : void 0;
|
|
1517
1637
|
}
|
|
1518
1638
|
function hookLabel(type) {
|
|
1519
1639
|
switch (type) {
|
|
1520
1640
|
case "BEFORE_TEST_CASE":
|
|
1521
|
-
return "Before
|
|
1641
|
+
return "Before";
|
|
1522
1642
|
case "AFTER_TEST_CASE":
|
|
1523
|
-
return "After
|
|
1643
|
+
return "After";
|
|
1524
1644
|
case "BEFORE_TEST_STEP":
|
|
1525
|
-
return "
|
|
1645
|
+
return "BeforeStep";
|
|
1526
1646
|
case "AFTER_TEST_STEP":
|
|
1527
|
-
return "
|
|
1647
|
+
return "AfterStep";
|
|
1528
1648
|
case "BEFORE_TEST_RUN":
|
|
1529
|
-
return "
|
|
1649
|
+
return "BeforeAll";
|
|
1530
1650
|
case "AFTER_TEST_RUN":
|
|
1531
|
-
return "
|
|
1651
|
+
return "AfterAll";
|
|
1532
1652
|
default:
|
|
1533
1653
|
return "Hook";
|
|
1534
1654
|
}
|
|
1535
1655
|
}
|
|
1536
|
-
function
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
"image/gif": "gif",
|
|
1541
|
-
"image/jpeg": "jpg",
|
|
1542
|
-
"image/png": "png",
|
|
1543
|
-
"image/svg+xml": "svg",
|
|
1544
|
-
"text/html": "html",
|
|
1545
|
-
"text/plain": "txt",
|
|
1546
|
-
"video/mp4": "mp4",
|
|
1547
|
-
"video/webm": "webm"
|
|
1548
|
-
};
|
|
1549
|
-
return map[mediaType.toLowerCase()] ?? mediaType.split("/")[1]?.split(";")[0] ?? "bin";
|
|
1656
|
+
function attachmentFileName(fileName, mediaType) {
|
|
1657
|
+
if (fileName) return fileName;
|
|
1658
|
+
const extension = MEDIA_EXTENSIONS[normalizedMediaType(mediaType)];
|
|
1659
|
+
return extension ? `attachment.${extension}` : "attachment";
|
|
1550
1660
|
}
|
|
1551
1661
|
function attachmentKind(mediaType) {
|
|
1552
|
-
|
|
1553
|
-
if (
|
|
1554
|
-
if (
|
|
1555
|
-
if (
|
|
1662
|
+
const base = normalizedMediaType(mediaType);
|
|
1663
|
+
if (base.startsWith("image/")) return "image";
|
|
1664
|
+
if (base.startsWith("video/")) return "video";
|
|
1665
|
+
if (base.startsWith("audio/")) return "audio";
|
|
1666
|
+
if (base.startsWith("text/") || base.includes("json")) {
|
|
1556
1667
|
return "text";
|
|
1557
1668
|
}
|
|
1558
1669
|
return "binary";
|
|
1559
1670
|
}
|
|
1560
|
-
function toAttachment(attachment
|
|
1671
|
+
function toAttachment(attachment) {
|
|
1561
1672
|
const body = attachment.body ?? "";
|
|
1562
|
-
const mediaType = attachment.mediaType || "application/octet-stream";
|
|
1673
|
+
const mediaType = safeMediaType(attachment.mediaType || "application/octet-stream");
|
|
1563
1674
|
const kind = attachmentKind(mediaType);
|
|
1564
|
-
const fileName = attachment.fileName
|
|
1675
|
+
const fileName = attachmentFileName(attachment.fileName, mediaType);
|
|
1565
1676
|
const isBase64 = attachment.contentEncoding === "BASE64";
|
|
1566
1677
|
const bytes = isBase64 ? Math.max(0, Math.floor(body.length * 3 / 4) - (body.endsWith("==") ? 2 : body.endsWith("=") ? 1 : 0)) : Buffer.byteLength(body, "utf8");
|
|
1567
1678
|
if (kind === "image" || kind === "video" || kind === "audio") {
|
|
@@ -1622,13 +1733,70 @@ function count(counts, status) {
|
|
|
1622
1733
|
counts.total += 1;
|
|
1623
1734
|
counts[status] += 1;
|
|
1624
1735
|
}
|
|
1736
|
+
function backgroundRow(background) {
|
|
1737
|
+
if (isSyntheticBackground(background)) return void 0;
|
|
1738
|
+
return {
|
|
1739
|
+
id: background.id,
|
|
1740
|
+
keyword: background.keyword || "Background",
|
|
1741
|
+
name: background.name ?? "",
|
|
1742
|
+
description: normalizeText2(background.description)
|
|
1743
|
+
};
|
|
1744
|
+
}
|
|
1745
|
+
function backgroundsOf(children) {
|
|
1746
|
+
const rows = [];
|
|
1747
|
+
for (const child of children ?? []) {
|
|
1748
|
+
if (!child.background) continue;
|
|
1749
|
+
const row = backgroundRow(child.background);
|
|
1750
|
+
if (row) rows.push(row);
|
|
1751
|
+
}
|
|
1752
|
+
return rows;
|
|
1753
|
+
}
|
|
1754
|
+
function ruleMetadata(rule) {
|
|
1755
|
+
return {
|
|
1756
|
+
id: rule.id,
|
|
1757
|
+
keyword: rule.keyword || "Rule",
|
|
1758
|
+
name: rule.name ?? "",
|
|
1759
|
+
description: normalizeText2(rule.description),
|
|
1760
|
+
tags: (rule.tags ?? []).map((tag) => tag.name),
|
|
1761
|
+
backgrounds: backgroundsOf(rule.children ?? [])
|
|
1762
|
+
};
|
|
1763
|
+
}
|
|
1625
1764
|
function featureTree(document) {
|
|
1626
1765
|
const map = /* @__PURE__ */ new Map();
|
|
1627
1766
|
if (!document) return map;
|
|
1628
|
-
const visit = (children,
|
|
1767
|
+
const visit = (children, rule) => {
|
|
1768
|
+
for (const child of children) {
|
|
1769
|
+
if (child.scenario) {
|
|
1770
|
+
map.set(child.scenario.id, { scenario: child.scenario, ...rule ? { rule } : {} });
|
|
1771
|
+
}
|
|
1772
|
+
if ("rule" in child && child.rule) {
|
|
1773
|
+
visit(child.rule.children ?? [], ruleMetadata(child.rule));
|
|
1774
|
+
}
|
|
1775
|
+
}
|
|
1776
|
+
};
|
|
1777
|
+
visit(document.children ?? []);
|
|
1778
|
+
return map;
|
|
1779
|
+
}
|
|
1780
|
+
function exampleRowTree(document, uri) {
|
|
1781
|
+
const map = /* @__PURE__ */ new Map();
|
|
1782
|
+
if (!document) return map;
|
|
1783
|
+
const visit = (children) => {
|
|
1629
1784
|
for (const child of children) {
|
|
1630
|
-
if (child.scenario)
|
|
1631
|
-
|
|
1785
|
+
if (child.scenario) {
|
|
1786
|
+
const scenario = child.scenario;
|
|
1787
|
+
(scenario.examples ?? []).forEach((examples, examplesIndex) => {
|
|
1788
|
+
(examples.tableBody ?? []).forEach((row, exampleIndex) => {
|
|
1789
|
+
map.set(row.id, {
|
|
1790
|
+
uri,
|
|
1791
|
+
scenario,
|
|
1792
|
+
examples,
|
|
1793
|
+
examplesIndex,
|
|
1794
|
+
exampleIndex
|
|
1795
|
+
});
|
|
1796
|
+
});
|
|
1797
|
+
});
|
|
1798
|
+
}
|
|
1799
|
+
if ("rule" in child && child.rule) visit(child.rule.children ?? []);
|
|
1632
1800
|
}
|
|
1633
1801
|
};
|
|
1634
1802
|
visit(document.children ?? []);
|
|
@@ -1640,17 +1808,21 @@ function buildReportModel(envelopes, provenance) {
|
|
|
1640
1808
|
const featureSeen = /* @__PURE__ */ new Set();
|
|
1641
1809
|
const featureOrder = [];
|
|
1642
1810
|
const scenarioTree = /* @__PURE__ */ new Map();
|
|
1811
|
+
const outlineRows = /* @__PURE__ */ new Map();
|
|
1643
1812
|
const featureByScenarioId = /* @__PURE__ */ new Map();
|
|
1644
1813
|
const stepById = /* @__PURE__ */ new Map();
|
|
1645
1814
|
const pickles = /* @__PURE__ */ new Map();
|
|
1646
1815
|
const testCases = /* @__PURE__ */ new Map();
|
|
1647
1816
|
const started = /* @__PURE__ */ new Map();
|
|
1648
1817
|
const hooks = /* @__PURE__ */ new Map();
|
|
1818
|
+
const runHookStarts = /* @__PURE__ */ new Map();
|
|
1819
|
+
const runHookFinishes = /* @__PURE__ */ new Map();
|
|
1649
1820
|
const results = /* @__PURE__ */ new Map();
|
|
1650
1821
|
const attachments = /* @__PURE__ */ new Map();
|
|
1651
|
-
const
|
|
1822
|
+
const runHookAttachments = /* @__PURE__ */ new Map();
|
|
1823
|
+
const suggestions = /* @__PURE__ */ new Map();
|
|
1824
|
+
const stepDefinitions = /* @__PURE__ */ new Map();
|
|
1652
1825
|
const attachmentCache = /* @__PURE__ */ new Map();
|
|
1653
|
-
let attachmentIndex = 0;
|
|
1654
1826
|
let startedAt;
|
|
1655
1827
|
let finishedAt;
|
|
1656
1828
|
let source = "Cucumber";
|
|
@@ -1658,7 +1830,7 @@ function buildReportModel(envelopes, provenance) {
|
|
|
1658
1830
|
const mapAttachments = (list) => list.map((attachment) => {
|
|
1659
1831
|
const cached = attachmentCache.get(attachment);
|
|
1660
1832
|
if (cached) return cached;
|
|
1661
|
-
const mapped = toAttachment(attachment
|
|
1833
|
+
const mapped = toAttachment(attachment);
|
|
1662
1834
|
attachmentCache.set(attachment, mapped);
|
|
1663
1835
|
return mapped;
|
|
1664
1836
|
});
|
|
@@ -1666,12 +1838,14 @@ function buildReportModel(envelopes, provenance) {
|
|
|
1666
1838
|
if (envelope.meta) {
|
|
1667
1839
|
const { implementation, runtime, os, cpu, protocolVersion } = envelope.meta;
|
|
1668
1840
|
source = productLabel(implementation) ?? "Cucumber";
|
|
1841
|
+
const ci = environment?.ci ?? ciFromMeta(envelope.meta.ci);
|
|
1669
1842
|
const next = {
|
|
1670
1843
|
...implementation && productLabel(implementation) ? { producer: productLabel(implementation) } : {},
|
|
1671
1844
|
...runtime && productLabel(runtime) ? { runtime: productLabel(runtime) } : {},
|
|
1672
1845
|
...os && productLabel(os) ? { os: productLabel(os) } : {},
|
|
1673
1846
|
...cpu && productLabel(cpu) ? { cpu: productLabel(cpu) } : {},
|
|
1674
|
-
...protocolVersion ? { protocol: protocolVersion } : {}
|
|
1847
|
+
...protocolVersion ? { protocol: protocolVersion } : {},
|
|
1848
|
+
...ci ? { ci } : {}
|
|
1675
1849
|
};
|
|
1676
1850
|
if (Object.keys(next).length > 0) environment = next;
|
|
1677
1851
|
}
|
|
@@ -1697,6 +1871,9 @@ function buildReportModel(envelopes, provenance) {
|
|
|
1697
1871
|
scenarioTree.set(id, value);
|
|
1698
1872
|
featureByScenarioId.set(id, feature);
|
|
1699
1873
|
}
|
|
1874
|
+
for (const [id, value] of exampleRowTree(feature, uri ?? "")) {
|
|
1875
|
+
outlineRows.set(id, value);
|
|
1876
|
+
}
|
|
1700
1877
|
const collectSteps = (children) => {
|
|
1701
1878
|
for (const child of children) {
|
|
1702
1879
|
if (child.background) {
|
|
@@ -1713,17 +1890,49 @@ function buildReportModel(envelopes, provenance) {
|
|
|
1713
1890
|
if (envelope.pickle) pickles.set(envelope.pickle.id, envelope.pickle);
|
|
1714
1891
|
if (envelope.testCase) testCases.set(envelope.testCase.id, envelope.testCase);
|
|
1715
1892
|
if (envelope.testCaseStarted) started.set(envelope.testCaseStarted.id, envelope.testCaseStarted);
|
|
1716
|
-
if (envelope.testCaseFinished) finishedStarted.add(envelope.testCaseFinished.testCaseStartedId);
|
|
1717
1893
|
if (envelope.hook) hooks.set(envelope.hook.id, envelope.hook);
|
|
1894
|
+
if (envelope.testRunHookStarted) {
|
|
1895
|
+
runHookStarts.set(envelope.testRunHookStarted.id, envelope.testRunHookStarted);
|
|
1896
|
+
}
|
|
1897
|
+
if (envelope.testRunHookFinished) {
|
|
1898
|
+
runHookFinishes.set(
|
|
1899
|
+
envelope.testRunHookFinished.testRunHookStartedId,
|
|
1900
|
+
envelope.testRunHookFinished
|
|
1901
|
+
);
|
|
1902
|
+
}
|
|
1718
1903
|
if (envelope.testStepFinished) {
|
|
1719
1904
|
const list = results.get(envelope.testStepFinished.testCaseStartedId) ?? [];
|
|
1720
1905
|
list.push(envelope.testStepFinished);
|
|
1721
1906
|
results.set(envelope.testStepFinished.testCaseStartedId, list);
|
|
1722
1907
|
}
|
|
1723
1908
|
if (envelope.attachment) {
|
|
1724
|
-
const
|
|
1909
|
+
const key = envelope.attachment.testRunHookStartedId;
|
|
1910
|
+
const target = key ? runHookAttachments : attachments;
|
|
1911
|
+
const id = key ?? envelope.attachment.testCaseStartedId ?? "";
|
|
1912
|
+
const list = target.get(id) ?? [];
|
|
1725
1913
|
list.push(envelope.attachment);
|
|
1726
|
-
|
|
1914
|
+
target.set(id, list);
|
|
1915
|
+
}
|
|
1916
|
+
if (envelope.suggestion) {
|
|
1917
|
+
const snippets = Array.isArray(envelope.suggestion.snippets) ? envelope.suggestion.snippets : [];
|
|
1918
|
+
const list = snippets.filter((snippet) => typeof snippet?.code === "string").map((snippet) => ({
|
|
1919
|
+
...typeof snippet.language === "string" && snippet.language ? { language: snippet.language } : {},
|
|
1920
|
+
code: snippet.code
|
|
1921
|
+
}));
|
|
1922
|
+
if (list.length > 0) suggestions.set(envelope.suggestion.pickleStepId, list);
|
|
1923
|
+
}
|
|
1924
|
+
if (envelope.stepDefinition) {
|
|
1925
|
+
const pattern = envelope.stepDefinition.pattern;
|
|
1926
|
+
if (typeof pattern?.source === "string") {
|
|
1927
|
+
const reference = envelope.stepDefinition.sourceReference;
|
|
1928
|
+
const uri = typeof reference?.uri === "string" ? reference.uri : "";
|
|
1929
|
+
const line = typeof reference?.location?.line === "number" ? reference.location.line : void 0;
|
|
1930
|
+
const source2 = uri ? line ? `${uri}:${line}` : uri : void 0;
|
|
1931
|
+
stepDefinitions.set(envelope.stepDefinition.id, {
|
|
1932
|
+
pattern: pattern.source,
|
|
1933
|
+
...source2 ? { source: source2 } : {}
|
|
1934
|
+
});
|
|
1935
|
+
}
|
|
1727
1936
|
}
|
|
1728
1937
|
}
|
|
1729
1938
|
const testCasesByPickle = /* @__PURE__ */ new Map();
|
|
@@ -1741,34 +1950,39 @@ function buildReportModel(envelopes, provenance) {
|
|
|
1741
1950
|
const scenarioRows = [];
|
|
1742
1951
|
const scenarioCounts = emptyStatusCounts();
|
|
1743
1952
|
const stepCounts = emptyStatusCounts();
|
|
1953
|
+
const hookCounts = emptyStatusCounts();
|
|
1744
1954
|
const featureScenarios = /* @__PURE__ */ new Map();
|
|
1745
1955
|
for (const pickle of pickles.values()) {
|
|
1746
1956
|
const testCasesForPickle = testCasesByPickle.get(pickle.id) ?? [];
|
|
1747
1957
|
const candidates = testCasesForPickle.flatMap(
|
|
1748
1958
|
(testCase2) => startedByTestCase.get(testCase2.id) ?? []
|
|
1749
1959
|
);
|
|
1750
|
-
const
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
if (
|
|
1754
|
-
|
|
1755
|
-
if (candidate.attempt < current.attempt) return current;
|
|
1756
|
-
const cSeconds = candidate.timestamp?.seconds ?? 0;
|
|
1960
|
+
const latest = candidates.reduce((current, candidate2) => {
|
|
1961
|
+
if (!current) return candidate2;
|
|
1962
|
+
if (candidate2.attempt > current.attempt) return candidate2;
|
|
1963
|
+
if (candidate2.attempt < current.attempt) return current;
|
|
1964
|
+
const cSeconds = candidate2.timestamp?.seconds ?? 0;
|
|
1757
1965
|
const currentSeconds = current.timestamp?.seconds ?? 0;
|
|
1758
|
-
if (cSeconds !== currentSeconds) return cSeconds > currentSeconds ?
|
|
1759
|
-
const cNanos =
|
|
1966
|
+
if (cSeconds !== currentSeconds) return cSeconds > currentSeconds ? candidate2 : current;
|
|
1967
|
+
const cNanos = candidate2.timestamp?.nanos ?? 0;
|
|
1760
1968
|
const currentNanos = current.timestamp?.nanos ?? 0;
|
|
1761
|
-
return cNanos > currentNanos ?
|
|
1969
|
+
return cNanos > currentNanos ? candidate2 : current;
|
|
1762
1970
|
}, void 0);
|
|
1763
1971
|
if (!latest) continue;
|
|
1764
1972
|
const testCase = testCases.get(latest.testCaseId);
|
|
1765
1973
|
if (!testCase) continue;
|
|
1766
1974
|
const pickleSteps = new Map(pickle.steps.map((step) => [step.id, step]));
|
|
1767
|
-
const
|
|
1975
|
+
const rawResults = (results.get(latest.id) ?? []).map(
|
|
1976
|
+
(entry) => entry.testStepResult
|
|
1977
|
+
);
|
|
1978
|
+
const executed = rawResults.length > 0;
|
|
1979
|
+
const startedAttachments = executed ? attachments.get(latest.id) ?? [] : [];
|
|
1768
1980
|
const resultsByStep = new Map(
|
|
1769
1981
|
(results.get(latest.id) ?? []).map((entry) => [entry.testStepId, entry.testStepResult])
|
|
1770
1982
|
);
|
|
1771
1983
|
const stepRows = [];
|
|
1984
|
+
const hookRows = [];
|
|
1985
|
+
let testStepOrder = 0;
|
|
1772
1986
|
for (const testStep of testCase.testSteps) {
|
|
1773
1987
|
const result = resultsByStep.get(testStep.id);
|
|
1774
1988
|
if (!result) continue;
|
|
@@ -1780,8 +1994,30 @@ function buildReportModel(envelopes, provenance) {
|
|
|
1780
1994
|
startedAttachments.filter((attachment) => attachment.testStepId === testStep.id)
|
|
1781
1995
|
);
|
|
1782
1996
|
const message = stepResultMessage(result);
|
|
1997
|
+
const stepSuggestions = suggestions.get(testStep.pickleStepId) ?? [];
|
|
1998
|
+
const definitionIds = Array.isArray(testStep.stepDefinitionIds) ? testStep.stepDefinitionIds : [];
|
|
1999
|
+
const stepMatches = definitionIds.map((id) => stepDefinitions.get(id)).filter(
|
|
2000
|
+
(definition) => Boolean(definition)
|
|
2001
|
+
);
|
|
2002
|
+
const matchLists = testStep.stepMatchArgumentsLists ?? [];
|
|
2003
|
+
const parameters = [];
|
|
2004
|
+
if (matchLists.length === 1) {
|
|
2005
|
+
for (const argument of matchLists[0]?.stepMatchArguments ?? []) {
|
|
2006
|
+
const start = argument.group?.start;
|
|
2007
|
+
const value = argument.group?.value;
|
|
2008
|
+
if (typeof start !== "number" || !Number.isFinite(start) || typeof value !== "string" || value.length === 0) {
|
|
2009
|
+
continue;
|
|
2010
|
+
}
|
|
2011
|
+
parameters.push({
|
|
2012
|
+
start,
|
|
2013
|
+
value,
|
|
2014
|
+
type: argument.parameterTypeName || "anonymous"
|
|
2015
|
+
});
|
|
2016
|
+
}
|
|
2017
|
+
}
|
|
1783
2018
|
stepRows.push({
|
|
1784
2019
|
id: testStep.id,
|
|
2020
|
+
order: testStepOrder++,
|
|
1785
2021
|
keyword: data.keyword,
|
|
1786
2022
|
text: pickleStep?.text ?? "",
|
|
1787
2023
|
status: statusOf2(result.status),
|
|
@@ -1789,36 +2025,66 @@ function buildReportModel(envelopes, provenance) {
|
|
|
1789
2025
|
...message ? { message: stripAnsi(message) } : {},
|
|
1790
2026
|
...data.docString ? { docString: data.docString } : {},
|
|
1791
2027
|
...data.dataTable ? { dataTable: data.dataTable } : {},
|
|
2028
|
+
...stepSuggestions.length > 0 ? { suggestions: stepSuggestions } : {},
|
|
2029
|
+
...stepMatches.length > 0 ? { definitions: stepMatches } : {},
|
|
2030
|
+
...parameters.length > 0 ? { parameters } : {},
|
|
1792
2031
|
attachments: stepAttachments2
|
|
1793
2032
|
});
|
|
1794
2033
|
} else if (testStep.hookId) {
|
|
1795
2034
|
const hook = hooks.get(testStep.hookId);
|
|
1796
|
-
const
|
|
2035
|
+
const hookAttachments2 = mapAttachments(
|
|
1797
2036
|
startedAttachments.filter((attachment) => attachment.testStepId === testStep.id)
|
|
1798
2037
|
);
|
|
1799
2038
|
const message = stepResultMessage(result);
|
|
1800
|
-
|
|
2039
|
+
hookRows.push({
|
|
1801
2040
|
id: testStep.id,
|
|
1802
|
-
|
|
1803
|
-
|
|
2041
|
+
order: testStepOrder++,
|
|
2042
|
+
type: hookLabel(hook?.type),
|
|
2043
|
+
...hook?.name ? { name: hook.name } : {},
|
|
1804
2044
|
status: statusOf2(result.status),
|
|
1805
2045
|
durationMs: durationMs(result.duration),
|
|
1806
2046
|
...message ? { message: stripAnsi(message) } : {},
|
|
1807
|
-
attachments:
|
|
1808
|
-
hook: hook?.type
|
|
2047
|
+
attachments: hookAttachments2
|
|
1809
2048
|
});
|
|
1810
2049
|
}
|
|
1811
2050
|
}
|
|
1812
|
-
const
|
|
1813
|
-
const
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
2051
|
+
const status = executed ? statusOf2(getWorstTestStepResult(rawResults).status) : "unknown";
|
|
2052
|
+
const duration2 = [...stepRows, ...hookRows].reduce(
|
|
2053
|
+
(sum, entry) => sum + entry.durationMs,
|
|
2054
|
+
0
|
|
2055
|
+
);
|
|
2056
|
+
const astIds = pickle.astNodeIds ?? [];
|
|
2057
|
+
const candidate = astIds.length ? outlineRows.get(astIds.at(-1) ?? "") : void 0;
|
|
2058
|
+
const outlineExample = candidate && astIds.includes(candidate.scenario.id) && (!candidate.uri || !pickle.uri || candidate.uri === pickle.uri) ? candidate : void 0;
|
|
2059
|
+
const scenarioId = outlineExample?.scenario.id ?? astIds[0] ?? "";
|
|
2060
|
+
const tree = outlineExample ?? scenarioTree.get(scenarioId);
|
|
2061
|
+
const astEntry = outlineExample ? scenarioTree.get(outlineExample.scenario.id) : scenarioTree.get(scenarioId);
|
|
2062
|
+
const rule = astEntry?.rule;
|
|
2063
|
+
const feature = featureByScenarioId.get(scenarioId) ?? features.get(pickle.uri);
|
|
1817
2064
|
const stepAttachments = stepRows.flatMap((step) => step.attachments);
|
|
2065
|
+
const hookAttachments = hookRows.flatMap((hook) => hook.attachments);
|
|
1818
2066
|
const extraAttachments = mapAttachments(
|
|
1819
2067
|
startedAttachments.filter((attachment) => !attachment.testStepId)
|
|
1820
2068
|
);
|
|
1821
|
-
const scenarioAttachments = [
|
|
2069
|
+
const scenarioAttachments = [
|
|
2070
|
+
...stepAttachments,
|
|
2071
|
+
...hookAttachments,
|
|
2072
|
+
...extraAttachments
|
|
2073
|
+
];
|
|
2074
|
+
const outline = outlineExample ? {
|
|
2075
|
+
id: outlineExample.scenario.id,
|
|
2076
|
+
keyword: outlineExample.scenario.keyword,
|
|
2077
|
+
name: outlineExample.scenario.name,
|
|
2078
|
+
description: normalizeText2(outlineExample.scenario.description),
|
|
2079
|
+
tags: (outlineExample.scenario.tags ?? []).map((tag) => tag.name),
|
|
2080
|
+
examplesId: outlineExample.examples.id,
|
|
2081
|
+
examplesKeyword: outlineExample.examples.keyword,
|
|
2082
|
+
examplesName: outlineExample.examples.name,
|
|
2083
|
+
examplesDescription: normalizeText2(outlineExample.examples.description),
|
|
2084
|
+
examplesTags: (outlineExample.examples.tags ?? []).map((tag) => tag.name),
|
|
2085
|
+
examplesIndex: outlineExample.examplesIndex,
|
|
2086
|
+
exampleIndex: outlineExample.exampleIndex
|
|
2087
|
+
} : void 0;
|
|
1822
2088
|
const row = {
|
|
1823
2089
|
id: pickle.id,
|
|
1824
2090
|
name: pickle.name,
|
|
@@ -1826,19 +2092,27 @@ function buildReportModel(envelopes, provenance) {
|
|
|
1826
2092
|
description: normalizeText2(tree?.scenario.description),
|
|
1827
2093
|
uri: pickle.uri,
|
|
1828
2094
|
featureName: feature?.name ?? pickle.uri,
|
|
1829
|
-
...
|
|
2095
|
+
...rule ? { rule } : {},
|
|
2096
|
+
...rule?.name ? { ruleName: rule.name } : {},
|
|
1830
2097
|
status,
|
|
2098
|
+
executed,
|
|
1831
2099
|
durationMs: finiteDuration(duration2),
|
|
1832
2100
|
attempt: Number.isFinite(latest.attempt) ? latest.attempt : 0,
|
|
1833
2101
|
...timestampIso(latest.timestamp) ? { startedAt: timestampIso(latest.timestamp) } : {},
|
|
1834
|
-
tags: pickle.tags.map((tag) => tag.name),
|
|
2102
|
+
ownTags: outlineExample ? (outlineExample.examples.tags ?? []).map((tag) => tag.name) : tree ? (tree.scenario.tags ?? []).map((tag) => tag.name) : (pickle.tags ?? []).map((tag) => tag.name),
|
|
2103
|
+
tags: (pickle.tags ?? []).map((tag) => tag.name),
|
|
2104
|
+
...outline ? { outline } : {},
|
|
1835
2105
|
steps: stepRows,
|
|
2106
|
+
hooks: hookRows,
|
|
1836
2107
|
attachments: scenarioAttachments,
|
|
1837
2108
|
extraAttachments
|
|
1838
2109
|
};
|
|
1839
2110
|
scenarioRows.push(row);
|
|
1840
|
-
|
|
1841
|
-
|
|
2111
|
+
if (executed) {
|
|
2112
|
+
count(scenarioCounts, status);
|
|
2113
|
+
for (const step of stepRows) count(stepCounts, step.status);
|
|
2114
|
+
for (const hook of hookRows) count(hookCounts, hook.status);
|
|
2115
|
+
}
|
|
1842
2116
|
if (feature) {
|
|
1843
2117
|
const list = featureScenarios.get(feature) ?? [];
|
|
1844
2118
|
list.push(row);
|
|
@@ -1856,10 +2130,7 @@ function buildReportModel(envelopes, provenance) {
|
|
|
1856
2130
|
for (const feature of orderedFeatures) {
|
|
1857
2131
|
const scenarios = featureScenarios.get(feature) ?? [];
|
|
1858
2132
|
if (scenarios.length === 0) continue;
|
|
1859
|
-
const status =
|
|
1860
|
-
if (scenario.status === "passed") return worst;
|
|
1861
|
-
return statusSeverity(scenario.status) > statusSeverity(worst) ? scenario.status : worst;
|
|
1862
|
-
}, "unknown") : "passed";
|
|
2133
|
+
const status = worstExecutedStatus(scenarios);
|
|
1863
2134
|
const featureUri = featureUris.get(feature) ?? scenarios[0]?.uri ?? "";
|
|
1864
2135
|
const sourceFiles = /* @__PURE__ */ new Set([
|
|
1865
2136
|
...scenarios.map((scenario) => provenance?.get(scenario.uri)),
|
|
@@ -1872,7 +2143,8 @@ function buildReportModel(envelopes, provenance) {
|
|
|
1872
2143
|
keyword: feature.keyword,
|
|
1873
2144
|
uri: scenarios[0]?.uri ?? "",
|
|
1874
2145
|
description: normalizeText2(feature.description),
|
|
1875
|
-
tags: feature.tags.map((tag) => tag.name),
|
|
2146
|
+
tags: (feature.tags ?? []).map((tag) => tag.name),
|
|
2147
|
+
backgrounds: backgroundsOf(feature.children ?? []),
|
|
1876
2148
|
status,
|
|
1877
2149
|
durationMs: finiteDuration(
|
|
1878
2150
|
scenarios.reduce((sum, scenario) => sum + scenario.durationMs, 0)
|
|
@@ -1885,22 +2157,51 @@ function buildReportModel(envelopes, provenance) {
|
|
|
1885
2157
|
if (featureRows.some((feature) => !feature.sourceFile)) {
|
|
1886
2158
|
for (const feature of featureRows) delete feature.sourceFile;
|
|
1887
2159
|
}
|
|
2160
|
+
const runHooks = [];
|
|
2161
|
+
const orderedRunHooks = [...runHookStarts.values()].map((start, index) => ({ start, index })).sort((a, b) => {
|
|
2162
|
+
const seconds = (a.start.timestamp?.seconds ?? 0) - (b.start.timestamp?.seconds ?? 0);
|
|
2163
|
+
if (seconds !== 0) return seconds;
|
|
2164
|
+
const nanos = (a.start.timestamp?.nanos ?? 0) - (b.start.timestamp?.nanos ?? 0);
|
|
2165
|
+
return nanos !== 0 ? nanos : a.index - b.index;
|
|
2166
|
+
});
|
|
2167
|
+
for (const { start } of orderedRunHooks) {
|
|
2168
|
+
const finish = runHookFinishes.get(start.id);
|
|
2169
|
+
const hook = hooks.get(start.hookId);
|
|
2170
|
+
const result = finish?.result;
|
|
2171
|
+
const message = result ? stepResultMessage(result) : "";
|
|
2172
|
+
runHooks.push({
|
|
2173
|
+
id: start.id,
|
|
2174
|
+
type: hookLabel(hook?.type),
|
|
2175
|
+
...hook?.name ? { name: hook.name } : {},
|
|
2176
|
+
status: result ? statusOf2(result.status) : "unknown",
|
|
2177
|
+
durationMs: durationMs(result?.duration),
|
|
2178
|
+
...message ? { message: stripAnsi(message) } : {},
|
|
2179
|
+
attachments: mapAttachments(runHookAttachments.get(start.id) ?? [])
|
|
2180
|
+
});
|
|
2181
|
+
}
|
|
2182
|
+
for (const hook of runHooks) count(hookCounts, hook.status);
|
|
1888
2183
|
const attachmentRows = scenarioRows.flatMap((scenario) => scenario.attachments);
|
|
1889
2184
|
const runAttachments = mapAttachments(attachments.get("") ?? []);
|
|
1890
|
-
const allAttachments = [
|
|
2185
|
+
const allAttachments = [
|
|
2186
|
+
...attachmentRows,
|
|
2187
|
+
...runHooks.flatMap((hook) => hook.attachments),
|
|
2188
|
+
...runAttachments
|
|
2189
|
+
];
|
|
1891
2190
|
return {
|
|
1892
2191
|
features: featureRows,
|
|
1893
2192
|
scenarios: scenarioRows,
|
|
2193
|
+
runHooks,
|
|
1894
2194
|
runAttachments,
|
|
1895
2195
|
counts: {
|
|
1896
2196
|
features: featureRows.length,
|
|
1897
2197
|
scenarios: scenarioCounts,
|
|
1898
2198
|
steps: stepCounts,
|
|
2199
|
+
hooks: hookCounts,
|
|
1899
2200
|
attachments: allAttachments.length,
|
|
1900
2201
|
attachmentBytes: allAttachments.reduce((sum, attachment) => sum + attachment.bytes, 0)
|
|
1901
2202
|
},
|
|
1902
2203
|
durationMs: finiteDuration(
|
|
1903
|
-
scenarioRows.reduce((sum, scenario) => sum + scenario.durationMs, 0)
|
|
2204
|
+
scenarioRows.reduce((sum, scenario) => sum + scenario.durationMs, 0) + runHooks.reduce((sum, hook) => sum + hook.durationMs, 0)
|
|
1904
2205
|
),
|
|
1905
2206
|
...startedAt ? { startedAt } : {},
|
|
1906
2207
|
...finishedAt ? { finishedAt } : {},
|
|
@@ -1910,20 +2211,8 @@ function buildReportModel(envelopes, provenance) {
|
|
|
1910
2211
|
}
|
|
1911
2212
|
|
|
1912
2213
|
// src/summary.ts
|
|
1913
|
-
import {
|
|
1914
|
-
|
|
1915
|
-
TestStepResultStatus as TestStepResultStatus4
|
|
1916
|
-
} from "@cucumber/messages";
|
|
1917
|
-
var SUMMARY_SCHEMA_VERSION = 1;
|
|
1918
|
-
var STATUS_ORDER2 = [
|
|
1919
|
-
TestStepResultStatus4.UNKNOWN,
|
|
1920
|
-
TestStepResultStatus4.PASSED,
|
|
1921
|
-
TestStepResultStatus4.SKIPPED,
|
|
1922
|
-
TestStepResultStatus4.PENDING,
|
|
1923
|
-
TestStepResultStatus4.UNDEFINED,
|
|
1924
|
-
TestStepResultStatus4.AMBIGUOUS,
|
|
1925
|
-
TestStepResultStatus4.FAILED
|
|
1926
|
-
];
|
|
2214
|
+
import { getWorstTestStepResult as getWorstTestStepResult2 } from "@cucumber/messages";
|
|
2215
|
+
var SUMMARY_SCHEMA_VERSION = 2;
|
|
1927
2216
|
var VALID_STATUSES = /* @__PURE__ */ new Set([
|
|
1928
2217
|
"passed",
|
|
1929
2218
|
"failed",
|
|
@@ -1993,9 +2282,6 @@ function scenarioStatus(results) {
|
|
|
1993
2282
|
if (results.length === 0) return "unknown";
|
|
1994
2283
|
return toStatus(getWorstTestStepResult2(results).status);
|
|
1995
2284
|
}
|
|
1996
|
-
function statusOrdinal(status) {
|
|
1997
|
-
return STATUS_ORDER2.indexOf(status.toUpperCase());
|
|
1998
|
-
}
|
|
1999
2285
|
function displayUri(uri) {
|
|
2000
2286
|
const normalized = uri.replace(/\\/g, "/").replace(/^file:\/\/+/i, "");
|
|
2001
2287
|
if (!/^[a-z]:\//i.test(normalized) && !normalized.startsWith("/")) {
|
|
@@ -2003,8 +2289,11 @@ function displayUri(uri) {
|
|
|
2003
2289
|
}
|
|
2004
2290
|
const marker = normalized.lastIndexOf("/features/");
|
|
2005
2291
|
if (marker >= 0) return normalized.slice(marker + 1);
|
|
2006
|
-
const parts = normalized.split("/").filter(Boolean);
|
|
2007
|
-
|
|
2292
|
+
const parts = normalized.replace(/^[a-z]:/i, "").split("/").filter(Boolean);
|
|
2293
|
+
if (parts.length > 1 && /^(Users|home|Documents and Settings)$/i.test(parts[0] ?? "")) {
|
|
2294
|
+
parts.splice(0, 2);
|
|
2295
|
+
}
|
|
2296
|
+
return parts.slice(-3).join("/") || uri;
|
|
2008
2297
|
}
|
|
2009
2298
|
function featureTree2(document) {
|
|
2010
2299
|
const stepKeywords = /* @__PURE__ */ new Map();
|
|
@@ -2042,11 +2331,14 @@ function summarizeEnvelopes(input) {
|
|
|
2042
2331
|
const testCasesByPickle = /* @__PURE__ */ new Map();
|
|
2043
2332
|
const startedByTestCase = /* @__PURE__ */ new Map();
|
|
2044
2333
|
const hooks = /* @__PURE__ */ new Map();
|
|
2334
|
+
const runHookStarts = /* @__PURE__ */ new Map();
|
|
2335
|
+
const runHookFinishes = /* @__PURE__ */ new Map();
|
|
2045
2336
|
const results = /* @__PURE__ */ new Map();
|
|
2046
2337
|
const attachments = /* @__PURE__ */ new Map();
|
|
2047
2338
|
const attachmentList = [];
|
|
2048
|
-
const finishedIds = /* @__PURE__ */ new Set();
|
|
2049
2339
|
const scenarioFeatures = /* @__PURE__ */ new Map();
|
|
2340
|
+
const suggestions = /* @__PURE__ */ new Map();
|
|
2341
|
+
const stepDefinitions = /* @__PURE__ */ new Map();
|
|
2050
2342
|
const indexFeature = (feature) => {
|
|
2051
2343
|
const visit = (children) => {
|
|
2052
2344
|
for (const child of children) {
|
|
@@ -2075,10 +2367,16 @@ function summarizeEnvelopes(input) {
|
|
|
2075
2367
|
list.push(envelope.testCaseStarted);
|
|
2076
2368
|
startedByTestCase.set(envelope.testCaseStarted.testCaseId, list);
|
|
2077
2369
|
}
|
|
2078
|
-
if (envelope.testCaseFinished) {
|
|
2079
|
-
finishedIds.add(envelope.testCaseFinished.testCaseStartedId);
|
|
2080
|
-
}
|
|
2081
2370
|
if (envelope.hook) hooks.set(envelope.hook.id, envelope.hook);
|
|
2371
|
+
if (envelope.testRunHookStarted) {
|
|
2372
|
+
runHookStarts.set(envelope.testRunHookStarted.id, envelope.testRunHookStarted);
|
|
2373
|
+
}
|
|
2374
|
+
if (envelope.testRunHookFinished) {
|
|
2375
|
+
runHookFinishes.set(
|
|
2376
|
+
envelope.testRunHookFinished.testRunHookStartedId,
|
|
2377
|
+
envelope.testRunHookFinished
|
|
2378
|
+
);
|
|
2379
|
+
}
|
|
2082
2380
|
if (envelope.testStepFinished) {
|
|
2083
2381
|
const list = results.get(envelope.testStepFinished.testCaseStartedId) ?? [];
|
|
2084
2382
|
list.push(envelope.testStepFinished);
|
|
@@ -2093,6 +2391,28 @@ function summarizeEnvelopes(input) {
|
|
|
2093
2391
|
attachments.set(startedId, list);
|
|
2094
2392
|
}
|
|
2095
2393
|
}
|
|
2394
|
+
if (envelope.suggestion) {
|
|
2395
|
+
const snippets = Array.isArray(envelope.suggestion.snippets) ? envelope.suggestion.snippets : [];
|
|
2396
|
+
const list = snippets.filter((snippet) => typeof snippet?.code === "string").map((snippet) => ({
|
|
2397
|
+
...typeof snippet.language === "string" && snippet.language ? { language: snippet.language } : {},
|
|
2398
|
+
code: snippet.code
|
|
2399
|
+
}));
|
|
2400
|
+
if (list.length > 0) suggestions.set(envelope.suggestion.pickleStepId, list);
|
|
2401
|
+
}
|
|
2402
|
+
if (envelope.stepDefinition) {
|
|
2403
|
+
const pattern = envelope.stepDefinition.pattern;
|
|
2404
|
+
if (typeof pattern?.source === "string") {
|
|
2405
|
+
const reference = envelope.stepDefinition.sourceReference;
|
|
2406
|
+
const uri = typeof reference?.uri === "string" ? reference.uri : "";
|
|
2407
|
+
const line = typeof reference?.location?.line === "number" ? reference.location.line : void 0;
|
|
2408
|
+
const display = displayUri(uri);
|
|
2409
|
+
const source = display ? line ? `${display}:${line}` : display : void 0;
|
|
2410
|
+
stepDefinitions.set(envelope.stepDefinition.id, {
|
|
2411
|
+
pattern: pattern.source,
|
|
2412
|
+
...source ? { source } : {}
|
|
2413
|
+
});
|
|
2414
|
+
}
|
|
2415
|
+
}
|
|
2096
2416
|
}
|
|
2097
2417
|
const treeCache = /* @__PURE__ */ new Map();
|
|
2098
2418
|
const treeOf = (feature) => {
|
|
@@ -2108,12 +2428,8 @@ function summarizeEnvelopes(input) {
|
|
|
2108
2428
|
const candidates = testCases.flatMap(
|
|
2109
2429
|
(testCase) => startedByTestCase.get(testCase.id) ?? []
|
|
2110
2430
|
);
|
|
2111
|
-
const finishedCandidates = candidates.filter(
|
|
2112
|
-
(candidate) => finishedIds.has(candidate.id)
|
|
2113
|
-
);
|
|
2114
|
-
const pool = finishedCandidates.length ? finishedCandidates : candidates.filter((candidate) => (results.get(candidate.id)?.length ?? 0) > 0);
|
|
2115
2431
|
let latest;
|
|
2116
|
-
for (const candidate of
|
|
2432
|
+
for (const candidate of candidates) {
|
|
2117
2433
|
if (!latest) {
|
|
2118
2434
|
latest = candidate;
|
|
2119
2435
|
continue;
|
|
@@ -2133,7 +2449,8 @@ function summarizeEnvelopes(input) {
|
|
|
2133
2449
|
const testCases = testCasesByPickle.get(pickle.id) ?? [];
|
|
2134
2450
|
const testSteps = testCases.flatMap((testCase) => testCase.testSteps);
|
|
2135
2451
|
const started = latestByPickle.get(pickle.id);
|
|
2136
|
-
|
|
2452
|
+
if (!started) continue;
|
|
2453
|
+
const finished = results.get(started.id) ?? [];
|
|
2137
2454
|
const resultByStep = new Map(
|
|
2138
2455
|
finished.map((entry) => [entry.testStepId, entry.testStepResult])
|
|
2139
2456
|
);
|
|
@@ -2151,36 +2468,49 @@ function summarizeEnvelopes(input) {
|
|
|
2151
2468
|
if (testStep.pickleStepId) {
|
|
2152
2469
|
const pickleStep = pickleSteps.get(testStep.pickleStepId);
|
|
2153
2470
|
const astNodeId = pickleStep?.astNodeIds[0];
|
|
2471
|
+
const status2 = toStatus(result.status);
|
|
2472
|
+
const stepSuggestions = status2 === "undefined" ? suggestions.get(testStep.pickleStepId) ?? [] : [];
|
|
2473
|
+
const definitionIds = status2 === "ambiguous" && Array.isArray(testStep.stepDefinitionIds) ? testStep.stepDefinitionIds : [];
|
|
2474
|
+
const stepMatches = definitionIds.map((id) => stepDefinitions.get(id)).filter(
|
|
2475
|
+
(definition) => Boolean(definition)
|
|
2476
|
+
);
|
|
2154
2477
|
steps.push({
|
|
2155
2478
|
keyword: astNodeId ? (tree.stepKeywords.get(astNodeId) ?? "").trim() : "",
|
|
2156
2479
|
text: pickleStep?.text ?? "",
|
|
2157
|
-
status:
|
|
2480
|
+
status: status2,
|
|
2158
2481
|
durationMs: durationMs2(result.duration),
|
|
2159
|
-
...message ? { message } : {}
|
|
2482
|
+
...message ? { message: stripAnsi(message) } : {},
|
|
2483
|
+
...stepSuggestions.length > 0 ? { suggestions: stepSuggestions } : {},
|
|
2484
|
+
...stepMatches.length > 0 ? { definitions: stepMatches } : {}
|
|
2160
2485
|
});
|
|
2161
2486
|
} else if (testStep.hookId) {
|
|
2162
2487
|
const hook = hooks.get(testStep.hookId);
|
|
2163
2488
|
steps.push({
|
|
2164
2489
|
keyword: "Hook",
|
|
2165
2490
|
text: hook?.type ?? "hook",
|
|
2491
|
+
...hook?.name ? { name: hook.name } : {},
|
|
2166
2492
|
status: toStatus(result.status),
|
|
2167
2493
|
durationMs: durationMs2(result.duration),
|
|
2168
|
-
...message ? { message } : {}
|
|
2494
|
+
...message ? { message: stripAnsi(message) } : {}
|
|
2169
2495
|
});
|
|
2170
2496
|
}
|
|
2171
2497
|
}
|
|
2172
2498
|
const status = scenarioStatus(finished.map((entry) => entry.testStepResult));
|
|
2499
|
+
const executed = finished.length > 0;
|
|
2173
2500
|
const scenarioDuration = steps.reduce((sum, step) => sum + step.durationMs, 0);
|
|
2174
|
-
const scenarioAttachments =
|
|
2501
|
+
const scenarioAttachments = executed ? attachments.get(started.id) ?? [] : [];
|
|
2175
2502
|
for (const attachment of scenarioAttachments) countedAttachments.add(attachment);
|
|
2176
|
-
|
|
2177
|
-
|
|
2503
|
+
if (executed) {
|
|
2504
|
+
countStatus(scenarioCounts, status);
|
|
2505
|
+
for (const step of steps) countStatus(stepCounts, step.status);
|
|
2506
|
+
}
|
|
2178
2507
|
totalDuration += scenarioDuration;
|
|
2179
2508
|
scenarios.push({
|
|
2180
2509
|
name: pickle.name ?? "",
|
|
2181
2510
|
uri: displayUri(pickle.uri ?? ""),
|
|
2182
2511
|
feature: tree.featureName,
|
|
2183
2512
|
status,
|
|
2513
|
+
executed,
|
|
2184
2514
|
durationMs: finiteDuration2(scenarioDuration),
|
|
2185
2515
|
attempt: started?.attempt ?? 0,
|
|
2186
2516
|
tags: (pickle.tags ?? []).map((tag) => tag.name),
|
|
@@ -2191,10 +2521,19 @@ function summarizeEnvelopes(input) {
|
|
|
2191
2521
|
scenarios.sort(
|
|
2192
2522
|
(a, b) => a.uri.localeCompare(b.uri) || a.name.localeCompare(b.name)
|
|
2193
2523
|
);
|
|
2194
|
-
const
|
|
2195
|
-
|
|
2196
|
-
|
|
2524
|
+
const runHookResults = [];
|
|
2525
|
+
for (const start of runHookStarts.values()) {
|
|
2526
|
+
const result = runHookFinishes.get(start.id)?.result;
|
|
2527
|
+
if (result) runHookResults.push(result);
|
|
2528
|
+
}
|
|
2529
|
+
const runHookStatus = scenarioStatus(runHookResults);
|
|
2530
|
+
totalDuration += runHookResults.reduce(
|
|
2531
|
+
(sum, result) => sum + durationMs2(result.duration),
|
|
2532
|
+
0
|
|
2197
2533
|
);
|
|
2534
|
+
const executedScenarios = scenarios.filter((scenario) => scenario.executed);
|
|
2535
|
+
const scenarioOverall = worstExecutedStatus(executedScenarios);
|
|
2536
|
+
const overall = executedScenarios.length === 0 ? runHookStatus === "failed" ? "failed" : "unknown" : statusSeverity(runHookStatus) > statusSeverity(scenarioOverall) ? runHookStatus : scenarioOverall;
|
|
2198
2537
|
const orphanAttachments = attachmentList.filter(
|
|
2199
2538
|
(attachment) => !attachment.testCaseStartedId || countedAttachments.has(attachment)
|
|
2200
2539
|
);
|
|
@@ -2234,7 +2573,7 @@ function isLogoDataUri(value) {
|
|
|
2234
2573
|
|
|
2235
2574
|
// src/render/escape.ts
|
|
2236
2575
|
function escapeHtml(value) {
|
|
2237
|
-
return String(value ?? "").replace(/[&<>"']/g, (character) => {
|
|
2576
|
+
return stripBidiControls(String(value ?? "")).replace(/[&<>"']/g, (character) => {
|
|
2238
2577
|
switch (character) {
|
|
2239
2578
|
case "&":
|
|
2240
2579
|
return "&";
|
|
@@ -2252,6 +2591,271 @@ function escapeHtml(value) {
|
|
|
2252
2591
|
});
|
|
2253
2592
|
}
|
|
2254
2593
|
|
|
2594
|
+
// src/render/ansi.ts
|
|
2595
|
+
function xtermColor(value) {
|
|
2596
|
+
const index = Math.max(16, Math.min(255, Math.floor(value)));
|
|
2597
|
+
if (index < 232) {
|
|
2598
|
+
const offset = index - 16;
|
|
2599
|
+
const component = (step) => (step === 0 ? 0 : 55 + step * 40).toString(16).padStart(2, "0");
|
|
2600
|
+
return `#${component(Math.floor(offset / 36))}${component(
|
|
2601
|
+
Math.floor(offset % 36 / 6)
|
|
2602
|
+
)}${component(offset % 6)}`;
|
|
2603
|
+
}
|
|
2604
|
+
const grey = 8 + (index - 232) * 10;
|
|
2605
|
+
const hex = Math.min(255, grey).toString(16).padStart(2, "0");
|
|
2606
|
+
return `#${hex}${hex}${hex}`;
|
|
2607
|
+
}
|
|
2608
|
+
function rgbColor(red, green, blue) {
|
|
2609
|
+
const channel = (value) => Math.max(0, Math.min(255, Math.round(value))).toString(16).padStart(2, "0");
|
|
2610
|
+
return `#${channel(red)}${channel(green)}${channel(blue)}`;
|
|
2611
|
+
}
|
|
2612
|
+
function applyIndexedColor(style, foreground, value) {
|
|
2613
|
+
if (value < 16) {
|
|
2614
|
+
if (foreground) {
|
|
2615
|
+
style.fgClass = `ansi-fg-${value}`;
|
|
2616
|
+
delete style.fgColor;
|
|
2617
|
+
} else {
|
|
2618
|
+
style.bgClass = `ansi-bg-${value}`;
|
|
2619
|
+
delete style.bgColor;
|
|
2620
|
+
}
|
|
2621
|
+
return;
|
|
2622
|
+
}
|
|
2623
|
+
const color = xtermColor(value);
|
|
2624
|
+
if (foreground) {
|
|
2625
|
+
style.fgColor = color;
|
|
2626
|
+
delete style.fgClass;
|
|
2627
|
+
} else {
|
|
2628
|
+
style.bgColor = color;
|
|
2629
|
+
delete style.bgClass;
|
|
2630
|
+
}
|
|
2631
|
+
}
|
|
2632
|
+
function applySgr(style, raw) {
|
|
2633
|
+
const parts = raw === "" ? ["0"] : raw.split(";");
|
|
2634
|
+
for (let index = 0; index < parts.length; index += 1) {
|
|
2635
|
+
const code = parts[index] === "" ? 0 : Number(parts[index]);
|
|
2636
|
+
if (!Number.isFinite(code)) continue;
|
|
2637
|
+
if (code === 0) {
|
|
2638
|
+
delete style.fgClass;
|
|
2639
|
+
delete style.bgClass;
|
|
2640
|
+
delete style.fgColor;
|
|
2641
|
+
delete style.bgColor;
|
|
2642
|
+
delete style.bold;
|
|
2643
|
+
delete style.dim;
|
|
2644
|
+
delete style.italic;
|
|
2645
|
+
delete style.underline;
|
|
2646
|
+
} else if (code === 1) {
|
|
2647
|
+
style.bold = true;
|
|
2648
|
+
} else if (code === 2) {
|
|
2649
|
+
style.dim = true;
|
|
2650
|
+
} else if (code === 3) {
|
|
2651
|
+
style.italic = true;
|
|
2652
|
+
} else if (code === 4) {
|
|
2653
|
+
style.underline = true;
|
|
2654
|
+
} else if (code === 22) {
|
|
2655
|
+
delete style.bold;
|
|
2656
|
+
delete style.dim;
|
|
2657
|
+
} else if (code === 23) {
|
|
2658
|
+
delete style.italic;
|
|
2659
|
+
} else if (code === 24) {
|
|
2660
|
+
delete style.underline;
|
|
2661
|
+
} else if (code >= 30 && code <= 37) {
|
|
2662
|
+
style.fgClass = `ansi-fg-${code - 30}`;
|
|
2663
|
+
delete style.fgColor;
|
|
2664
|
+
} else if (code === 39) {
|
|
2665
|
+
delete style.fgClass;
|
|
2666
|
+
delete style.fgColor;
|
|
2667
|
+
} else if (code >= 40 && code <= 47) {
|
|
2668
|
+
style.bgClass = `ansi-bg-${code - 40}`;
|
|
2669
|
+
delete style.bgColor;
|
|
2670
|
+
} else if (code === 49) {
|
|
2671
|
+
delete style.bgClass;
|
|
2672
|
+
delete style.bgColor;
|
|
2673
|
+
} else if (code >= 90 && code <= 97) {
|
|
2674
|
+
style.fgClass = `ansi-fg-${code - 90 + 8}`;
|
|
2675
|
+
delete style.fgColor;
|
|
2676
|
+
} else if (code >= 100 && code <= 107) {
|
|
2677
|
+
style.bgClass = `ansi-bg-${code - 100 + 8}`;
|
|
2678
|
+
delete style.bgColor;
|
|
2679
|
+
} else if (code === 38 || code === 48) {
|
|
2680
|
+
const mode = Number(parts[index + 1]);
|
|
2681
|
+
const foreground = code === 38;
|
|
2682
|
+
if (mode === 5 && index + 2 < parts.length) {
|
|
2683
|
+
const color = Number(parts[index + 2]);
|
|
2684
|
+
if (Number.isFinite(color)) {
|
|
2685
|
+
applyIndexedColor(style, foreground, color);
|
|
2686
|
+
}
|
|
2687
|
+
index += 2;
|
|
2688
|
+
} else if (mode === 2 && index + 4 < parts.length) {
|
|
2689
|
+
const red = Number(parts[index + 2]);
|
|
2690
|
+
const green = Number(parts[index + 3]);
|
|
2691
|
+
const blue = Number(parts[index + 4]);
|
|
2692
|
+
if (Number.isFinite(red) && Number.isFinite(green) && Number.isFinite(blue)) {
|
|
2693
|
+
const value = rgbColor(red, green, blue);
|
|
2694
|
+
if (foreground) {
|
|
2695
|
+
style.fgColor = value;
|
|
2696
|
+
delete style.fgClass;
|
|
2697
|
+
} else {
|
|
2698
|
+
style.bgColor = value;
|
|
2699
|
+
delete style.bgClass;
|
|
2700
|
+
}
|
|
2701
|
+
}
|
|
2702
|
+
index += 4;
|
|
2703
|
+
}
|
|
2704
|
+
}
|
|
2705
|
+
}
|
|
2706
|
+
}
|
|
2707
|
+
function hasStyle(style) {
|
|
2708
|
+
return Boolean(
|
|
2709
|
+
style.fgClass || style.bgClass || style.fgColor || style.bgColor || style.bold || style.dim || style.italic || style.underline
|
|
2710
|
+
);
|
|
2711
|
+
}
|
|
2712
|
+
function spanMarkup(style) {
|
|
2713
|
+
const classes = ["ansi"];
|
|
2714
|
+
if (style.fgClass) classes.push(style.fgClass);
|
|
2715
|
+
if (style.bgClass) classes.push(style.bgClass);
|
|
2716
|
+
if ((style.bgClass || style.bgColor) && !(style.fgClass || style.fgColor)) {
|
|
2717
|
+
classes.push("ansi-bg-only");
|
|
2718
|
+
}
|
|
2719
|
+
if (style.bold) classes.push("ansi-bold");
|
|
2720
|
+
if (style.dim) classes.push("ansi-dim");
|
|
2721
|
+
if (style.italic) classes.push("ansi-italic");
|
|
2722
|
+
if (style.underline) classes.push("ansi-underline");
|
|
2723
|
+
const css = [];
|
|
2724
|
+
if (style.fgColor) {
|
|
2725
|
+
classes.push("ansi-inline-fg");
|
|
2726
|
+
css.push(`--ansi-fg:${style.fgColor}`);
|
|
2727
|
+
}
|
|
2728
|
+
if (style.bgColor) {
|
|
2729
|
+
classes.push("ansi-inline-bg");
|
|
2730
|
+
css.push(`--ansi-bg:${style.bgColor}`);
|
|
2731
|
+
}
|
|
2732
|
+
const attributes = css.length ? ` style="${css.join(";")}"` : "";
|
|
2733
|
+
return `<span class="${classes.join(" ")}"${attributes}>`;
|
|
2734
|
+
}
|
|
2735
|
+
function ansiToHtml(text, colorize) {
|
|
2736
|
+
let output = "";
|
|
2737
|
+
let buffer = "";
|
|
2738
|
+
let style = {};
|
|
2739
|
+
let spanOpen = false;
|
|
2740
|
+
const flush = () => {
|
|
2741
|
+
if (buffer) {
|
|
2742
|
+
output += escapeHtml(buffer);
|
|
2743
|
+
buffer = "";
|
|
2744
|
+
}
|
|
2745
|
+
};
|
|
2746
|
+
const closeSpan = () => {
|
|
2747
|
+
if (!spanOpen) return;
|
|
2748
|
+
flush();
|
|
2749
|
+
output += "</span>";
|
|
2750
|
+
spanOpen = false;
|
|
2751
|
+
};
|
|
2752
|
+
const openSpan = () => {
|
|
2753
|
+
closeSpan();
|
|
2754
|
+
if (!colorize || !hasStyle(style)) return;
|
|
2755
|
+
output += spanMarkup(style);
|
|
2756
|
+
spanOpen = true;
|
|
2757
|
+
};
|
|
2758
|
+
for (let index = 0; index < text.length; index += 1) {
|
|
2759
|
+
const character = text[index] ?? "";
|
|
2760
|
+
const code = text.charCodeAt(index);
|
|
2761
|
+
if (isEscapeIntroducer(code)) {
|
|
2762
|
+
const scan = scanEscape(text, index);
|
|
2763
|
+
if (scan.sgr !== void 0) {
|
|
2764
|
+
flush();
|
|
2765
|
+
if (colorize) applySgr(style, scan.sgr);
|
|
2766
|
+
openSpan();
|
|
2767
|
+
}
|
|
2768
|
+
index = scan.end - 1;
|
|
2769
|
+
continue;
|
|
2770
|
+
}
|
|
2771
|
+
if (character === "\x07" || code === 127 || code < 32 && character !== "\n" && character !== " " || code >= 128 && code <= 159) {
|
|
2772
|
+
continue;
|
|
2773
|
+
}
|
|
2774
|
+
buffer += character;
|
|
2775
|
+
}
|
|
2776
|
+
closeSpan();
|
|
2777
|
+
flush();
|
|
2778
|
+
return output;
|
|
2779
|
+
}
|
|
2780
|
+
function renderAnsiLog(text) {
|
|
2781
|
+
return ansiToHtml(
|
|
2782
|
+
text,
|
|
2783
|
+
Buffer.byteLength(text, "utf8") <= MAX_TEXT_ATTACHMENT_BYTES
|
|
2784
|
+
);
|
|
2785
|
+
}
|
|
2786
|
+
|
|
2787
|
+
// src/render/client-bundle.ts
|
|
2788
|
+
var CLIENT_SCRIPT = '"use strict";var TolkiraSearch=(()=>{var E=Object.defineProperty;var T=Object.getOwnPropertyDescriptor;var U=Object.getOwnPropertyNames;var R=Object.prototype.hasOwnProperty;var A=(r,e)=>{for(var n in e)E(r,n,{get:e[n],enumerable:!0})},q=(r,e,n,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of U(e))!R.call(r,s)&&s!==n&&E(r,s,{get:()=>e[s],enumerable:!(t=T(e,s))||t.enumerable});return r};var C=r=>q(E({},"__esModule",{value:!0}),r);var F={};A(F,{SEARCH_OPEN_CAP:()=>$,compileTagExpression:()=>P,evaluateTagExpression:()=>B,isTagExpression:()=>O,parseUrlState:()=>D,rememberHiddenOpen:()=>N,rowsToOpen:()=>L,serializeUrlState:()=>I});var p="operand",c="operator",f={"(":-2,")":-1,or:0,and:1,not:2},w={or:"left",and:"left",not:"right"};function y(r){let e=W(r);if(e.length===0)return new m;let n=[],t=[],s=p;for(e.forEach(i=>{if(_(i))o(s,p),t.push(i),s=p;else if(j(i)){for(o(s,c);t.length>0&&z(h(t))&&(w[i]==="left"&&f[i]<=f[h(t)]||w[i]==="right"&&f[i]<f[h(t)]);)a(t.pop(),n);t.push(i),s=p}else if(i==="(")o(s,p),t.push(i),s=p;else if(i===")"){for(o(s,c);t.length>0&&h(t)!=="(";)a(t.pop(),n);if(t.length===0)throw new Error(`Tag expression "${r}" could not be parsed because of syntax error: Unmatched ).`);h(t)==="("&&t.pop(),s=c}else o(s,p),a(i,n),s=c});t.length>0;){if(h(t)==="(")throw new Error(`Tag expression "${r}" could not be parsed because of syntax error: Unmatched (.`);a(t.pop(),n)}return n.pop();function o(i,u){if(i!==u)throw new Error(`Tag expression "${r}" could not be parsed because of syntax error: Expected ${i}.`)}function a(i,u){if(i==="and"){let x=l(u);u.push(new d(l(u),x))}else if(i==="or"){let x=l(u);u.push(new g(l(u),x))}else i==="not"?u.push(new S(l(u))):u.push(new b(i))}function l(i){if(i.length===0)throw new Error(`Tag expression "${r}" could not be parsed because of syntax error: Expected operand.`);return i.pop()}}function W(r){let e=[],n=!1,t=[];for(let s=0;s<r.length;s++){let o=r.charAt(s);if(n)if(o==="("||o===")"||o==="\\\\"||/\\s/.test(o))t.push(o),n=!1;else throw new Error(`Tag expression "${r}" could not be parsed because of syntax error: Illegal escape before "${o}".`);else o==="\\\\"?n=!0:o==="("||o===")"||/\\s/.test(o)?(t.length>0&&(e.push(t.join("")),t=[]),/\\s/.test(o)||e.push(o)):t.push(o)}return t.length>0&&e.push(t.join("")),e}function _(r){return r==="not"}function j(r){return r==="or"||r==="and"}function z(r){return w[r]!==void 0}function h(r){return r[r.length-1]}var b=class{value;constructor(e){this.value=e}evaluate(e){return e.indexOf(this.value)!==-1}toString(){return this.value.replace(/\\\\/g,"\\\\\\\\").replace(/\\(/g,"\\\\(").replace(/\\)/g,"\\\\)").replace(/\\s/g,"\\\\ ")}},g=class{leftExpr;rightExpr;constructor(e,n){this.leftExpr=e,this.rightExpr=n}evaluate(e){return this.leftExpr.evaluate(e)||this.rightExpr.evaluate(e)}toString(){return`( ${this.leftExpr.toString()} or ${this.rightExpr.toString()} )`}},d=class{leftExpr;rightExpr;constructor(e,n){this.leftExpr=e,this.rightExpr=n}evaluate(e){return this.leftExpr.evaluate(e)&&this.rightExpr.evaluate(e)}toString(){return`( ${this.leftExpr.toString()} and ${this.rightExpr.toString()} )`}},S=class{expr;constructor(e){this.expr=e}evaluate(e){return!this.expr.evaluate(e)}toString(){return this.expr instanceof d||this.expr instanceof g?`not ${this.expr.toString()}`:`not ( ${this.expr.toString()} )`}},m=class{evaluate(e){return!0}toString(){return""}};var $=20;function v(r){return/\\s/.test(r)}function H(r){let e=0;for(;e<r.length;){let n=r[e];if(v(n)){e+=1;continue}if(n==="("||n===")"){e+=1;continue}if(n==="@"){e+=1;let o=e;for(;e<r.length;){let a=r[e];if(a==="\\\\"){e+=2;continue}if(v(a)||a==="("||a===")")break;e+=1}if(e>r.length||e===o)return!1;continue}let t=e;for(;e<r.length;){let o=r[e];if(v(o)||o==="("||o===")")break;e+=1}let s=r.slice(t,e);if(s!=="and"&&s!=="or"&&s!=="not")return!1}return!0}function O(r){let e=r.trim();return!e.includes("@")||!H(e)?!1:e.startsWith("@")||e.startsWith("(")?!0:e.startsWith("not")&&/^(?:\\s|\\(|$)/.test(e.slice(3))}function P(r){if(O(r))try{let e=y(r.trim());return n=>e.evaluate(n)}catch{return}}function B(r,e){return P(r)?.(e)}function D(r,e,n){let t=new URLSearchParams(r),s=new Set(e),o=new Set(n),a=[...new Set(t.getAll("hide"))].filter(i=>s.has(i)),l=t.get("tag")??"";return{query:t.get("query")??"",hidden:a,tag:o.has(l)?l:""}}function I(r,e){let n=new URL(r);e.query?n.searchParams.set("query",e.query):n.searchParams.delete("query"),n.searchParams.delete("hide");for(let t of e.hidden)n.searchParams.append("hide",t);return e.tag?n.searchParams.set("tag",e.tag):n.searchParams.delete("tag"),n.href}function L(r,e=$){if(e<=0)return[];let n=[];for(let t=0;t<r.length&&n.length<e;t+=1){let s=r[t];s?.visible&&!s.open&&n.push(t)}return n}function N(r,e){return r&&!e}return C(F);})();\n\n(function(){var f=Array.prototype.slice.call(document.querySelectorAll("[data-view]")),U=document.getElementById("report-view"),z=document.getElementById("analysis-view");function T(e){!U||!z||(U.hidden=e!=="report",z.hidden=e!=="analysis",f.forEach(function(a){var t=a.getAttribute("data-view")===e;a.setAttribute("aria-selected",t?"true":"false")}),window.scrollTo(0,0))}f.forEach(function(e){e.addEventListener("click",function(){T(e.getAttribute("data-view"))})});var F=document.querySelector(\'[role="tablist"]\');F&&F.addEventListener("keydown",function(e){if(["ArrowLeft","ArrowRight","Home","End"].includes(e.key)){e.preventDefault();var a=f.indexOf(document.activeElement);if(!(a<0)){var t=e.key==="Home"?0:e.key==="End"?f.length-1:(a+(e.key==="ArrowRight"?1:-1)+f.length)%f.length;f[t].focus(),T(f[t].getAttribute("data-view"))}}});var l={query:"",hidden:new Set,tag:""},E=[],L=[],x=new WeakMap,h=Array.prototype.slice.call(document.querySelectorAll("[data-scenario]")),Y=h.concat(Array.prototype.slice.call(document.querySelectorAll(".outlineTitle, .examplesTitle, .ruleTitle, .backgroundTitle"))),G=Array.prototype.slice.call(document.querySelectorAll("[data-feature]")),_=Array.prototype.slice.call(document.querySelectorAll("[data-examples]")).map(function(e){return{group:e,rows:Array.prototype.slice.call(e.querySelectorAll("[data-scenario]"))}}),J=Array.prototype.slice.call(document.querySelectorAll("[data-outline]")).map(function(e){return{group:e,rows:Array.prototype.slice.call(e.querySelectorAll("[data-scenario]"))}}),Q=Array.prototype.slice.call(document.querySelectorAll("[data-rule]")).map(function(e){return{group:e,rows:Array.prototype.slice.call(e.querySelectorAll("[data-scenario]"))}}),D=document.getElementById("tolkira-live"),m=document.getElementById("tolkira-search-note"),q=document.querySelector("[data-triage]"),V=document.querySelector("[data-sources]");function w(){var e=l.query.toLowerCase(),a=l.tag,t=typeof TolkiraSearch<"u"?TolkiraSearch.compileTagExpression(l.query):void 0,r=0;h.forEach(function(n){var o=n.getAttribute("data-status"),c=n.closest("[data-outline]"),y=n.closest("[data-examples]"),S=n.closest("[data-rule]"),b=n.closest("[data-feature]"),A=(c?" "+(c.getAttribute("data-search")||""):"")+(y?" "+(y.getAttribute("data-search")||""):"")+(S?" "+(S.getAttribute("data-search")||""):"")+(b?" "+(b.getAttribute("data-background-search")||""):""),O=((n.getAttribute("data-search")||"")+A).toLowerCase(),R=" "+(n.getAttribute("data-tags")||"")+" ",v=!a||R.indexOf(" "+a+" ")!==-1,ne=!t||t((n.getAttribute("data-tags")||"").split(" ").filter(Boolean)),oe=!!t||!e||O.indexOf(e)!==-1,M=!l.hidden.has(o)&&v&&ne&&oe;M?n.hidden&&x.has(n)&&(n.open=x.get(n),x.delete(n)):(n.hidden||x.set(n,TolkiraSearch.rememberHiddenOpen(n.open,E.indexOf(n)!==-1)),n.open=!1),n.hidden=!M,M&&(r+=1)}),G.forEach(function(n){var o=n.querySelectorAll("[data-scenario]"),c=Array.prototype.some.call(o,function(y){return!y.hidden});n.hidden=!c,c&&(e||l.hidden.size||a)&&(n.open=!0)}),_.forEach(function(n){var o=n.rows.some(function(c){return!c.hidden});n.group.hidden=!o}),J.forEach(function(n){var o=n.rows.some(function(c){return!c.hidden});n.group.hidden=!o}),Q.forEach(function(n){var o=n.rows.some(function(c){return!c.hidden});n.group.hidden=!o}),E.forEach(function(n){n.open=!1}),E=[],L.forEach(function(n){n.open=!1}),L=[];var i=e?TolkiraSearch.rowsToOpen(h.map(function(n){return{visible:!n.hidden,open:n.open}})):[];i.forEach(function(n){var o=h[n];o.open=!0,E.push(o)});var u=i.length;e&&h.forEach(function(n){n.hidden||!n.open||Array.prototype.slice.call(n.querySelectorAll("details.hookGroup")).forEach(function(o){o.open||(o.open=!0,L.push(o))})}),D&&(D.textContent=r+" of "+h.length+" scenarios visible"),m&&(e&&u===20&&r>20?(m.textContent="20 of "+r+" matches expanded. Use Expand all to open the rest.",m.hidden=!1):(m.hidden=!0,m.textContent=""));var s=document.getElementById("empty-results");s&&(s.hidden=r!==0),q&&(q.hidden=!!(e||a||l.hidden.size)),V&&(V.hidden=!!(e||a||l.hidden.size)),$()}function B(){typeof CSS>"u"||!CSS.highlights||CSS.highlights.delete("tolkira-search")}function Z(e){for(var a="",t=0;t<e.length;t++){var r=e.charCodeAt(t),i=e.charAt(t),u=r===92||r===94||r===36||r===46||r===42||r===43||r===63||r===40||r===41||r===91||r===93||r===123||r===125||r===124;a+=u?"\\\\"+i:i}return a}function $(){if(!(typeof CSS>"u"||!CSS.highlights||typeof Highlight>"u")){var e=l.query.trim();if(e.length<2){B();return}try{var a=new RegExp(Z(e),"gi"),t=[];Y.forEach(function(r){if(!(r.hidden||r.closest("[hidden]")||t.length>=200)&&!(r.hasAttribute("data-scenario")&&!r.open))for(var i=document.createTreeWalker(r,NodeFilter.SHOW_TEXT,null),u;t.length<200&&(u=i.nextNode());){var s=u.nodeValue;if(s){var n=u.parentElement;if(!(n&&(n.tagName==="SCRIPT"||n.tagName==="STYLE"))){a.lastIndex=0;for(var o;t.length<200&&(o=a.exec(s))!==null;){var c=document.createRange();c.setStart(u,o.index),c.setEnd(u,o.index+o[0].length),t.push(c),o[0].length===0&&(a.lastIndex+=1)}}}}}),B(),t.length&&CSS.highlights.set("tolkira-search",new Highlight(...t))}catch{B()}}}var g=document.querySelector("[data-search]"),p=document.querySelector("[data-tag-filter]");function I(){try{var e=TolkiraSearch.serializeUrlState(location.href,{query:l.query,hidden:Array.from(l.hidden),tag:l.tag});typeof history.replaceState=="function"&&history.replaceState(null,"",e)}catch{}}function ee(){var e=Array.prototype.slice.call(document.querySelectorAll("button.filter[data-status]")),a=e.map(function(i){return i.getAttribute("data-status")}),t=p?Array.prototype.map.call(p.options,function(i){return i.value}).filter(Boolean):[],r;try{r=TolkiraSearch.parseUrlState(location.search,a,t)}catch{return}r.query&&(l.query=r.query,g&&(g.value=r.query)),r.hidden.forEach(function(i){l.hidden.add(i)}),e.forEach(function(i){i.setAttribute("aria-pressed",l.hidden.has(i.getAttribute("data-status"))?"false":"true")}),r.tag&&p&&(l.tag=r.tag,p.value=r.tag),(l.query||l.hidden.size||l.tag)&&w()}g&&g.addEventListener("input",function(){l.query=g.value,w(),I()}),p&&p.addEventListener("change",function(){l.tag=p.value,w(),I()}),Array.prototype.slice.call(document.querySelectorAll("button.filter[data-status]")).forEach(function(e){e.addEventListener("click",function(){var a=e.getAttribute("data-status"),t=e.getAttribute("aria-pressed")!=="false";t?(l.hidden.add(a),e.setAttribute("aria-pressed","false")):(l.hidden.delete(a),e.setAttribute("aria-pressed","true")),w(),I()})}),Array.prototype.slice.call(document.querySelectorAll("[data-expand]")).forEach(function(e){e.addEventListener("click",function(){var a=e.getAttribute("data-expand")==="all";G.forEach(function(t){t.open=a}),h.forEach(function(t){t.open=a})})});var k=document.getElementById("tolkira-copy-live");function te(e){var a=document.activeElement,t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.position="fixed",t.style.top="-1000px",document.body.appendChild(t);var r=!1;try{t.select(),r=document.execCommand("copy")}catch{r=!1}finally{t.remove(),a&&typeof a.focus=="function"&&a.focus()}return r}function re(e,a){var t=!1;function r(u){t||(t=!0,a(u))}function i(){r(te(e))}if(navigator.clipboard&&typeof navigator.clipboard.writeText=="function")try{navigator.clipboard.writeText(e).then(function(){r(!0)},i)}catch{i()}else i()}function ae(e){var a=e.closest("[data-scenario]");if(!a)return"";var t=a.closest("[data-feature]"),r=t?t.querySelector("h2"):null,i=a.querySelector(".scenarioName"),u=a.getAttribute("data-scenario-name")||(i?i.textContent:""),s=a.getAttribute("data-example")||"",n=a.getAttribute("data-examples-name")||"",o=a.querySelector(\'.step[data-status="failed"]\'),c=o?null:a.querySelector(\'.hook[data-status="failed"]\'),y=o&&o.querySelector(".kw")?o.querySelector(".kw").textContent.trim():"",S=o?o.querySelector(".stepText"):null,b=S&&S.textContent||"",A=o?o.querySelector(".error"):c?c.querySelector(".error"):null,O=c?c.querySelector(".hookLabel")?c.querySelector(".hookLabel").textContent.trim():"Hook":(y+" "+b.trim()).trim(),R=c?"Hook: ":"Step: ",v=["Feature: "+(r?r.textContent:""),"Scenario: "+u];return s&&v.push("Example: "+s+(n?" ("+n+")":"")),v.push("URI: "+(a.getAttribute("data-uri")||""),R+O),A&&A.textContent.trim()&&v.push(`Error:\n`+A.textContent.trim()),v.join(`\n`)}function W(e,a,t,r,i){var u=null;e.addEventListener("click",function(){e.focus(),re(t(e),function(s){u&&clearTimeout(u),e.textContent=s?"Copied":"Copy failed",k&&(k.textContent=s?r:i),u=setTimeout(function(){e.textContent=a,k&&(k.textContent="")},2e3)})})}Array.prototype.slice.call(document.querySelectorAll("[data-copy-failure]")).forEach(function(e){W(e,"Copy failure",ae,"Failure details copied to clipboard.","Could not copy failure details.")}),Array.prototype.slice.call(document.querySelectorAll("[data-copy-log]")).forEach(function(e){e.hidden=!1,W(e,"Copy log",function(a){var t=a.closest("details"),r=t?t.querySelector("pre"):null;return r?r.textContent:""},"Log copied to clipboard.","Could not copy the log.")});var d=document.getElementById("tolkira-lightbox");if(d){let e=function(){typeof d.close=="function"?d.close():(d.removeAttribute("open"),a())},a=function(){document.documentElement.style.overflow=K,C&&(C.focus(),C=null)};var ie=e,le=a,H=d.querySelector("img"),j=d.querySelector("[data-lightbox-close]"),C=null,K="";Array.prototype.slice.call(document.querySelectorAll(".shotButton")).forEach(function(t){t.addEventListener("click",function(){var r=t.querySelector("img");!r||!H||(H.src=r.src,H.alt=r.alt,C=t,K=document.documentElement.style.overflow,document.documentElement.style.overflow="hidden",typeof d.showModal=="function"?d.showModal():d.setAttribute("open",""))})}),j&&j.addEventListener("click",e),d.addEventListener("click",function(t){t.target===d&&e()}),d.addEventListener("close",a)}function P(){if(location.hash){var e="";try{e=decodeURIComponent(location.hash.slice(1))}catch{return}var a=document.getElementById(e);if(a){for(var t=a;t;)t.tagName==="DETAILS"&&(t.open=!0),t=t.parentElement;var r=a.tagName==="DETAILS"?a.querySelector("summary"):a;if(r)try{r.focus({preventScroll:!0})}catch{r.focus()}a.scrollIntoView()}}}var N=window.matchMedia("(max-width: 560px)");function X(){q&&(q.open=!N.matches)}N.addEventListener&&N.addEventListener("change",X),X(),window.addEventListener("hashchange",P),ee(),T("report"),P()})();\n';
|
|
2789
|
+
|
|
2790
|
+
// src/render/markdown.ts
|
|
2791
|
+
import MarkdownIt from "markdown-it";
|
|
2792
|
+
var markdown = new MarkdownIt({
|
|
2793
|
+
html: false,
|
|
2794
|
+
linkify: false,
|
|
2795
|
+
typographer: false,
|
|
2796
|
+
breaks: true
|
|
2797
|
+
});
|
|
2798
|
+
var SAFE_LINK = /^(?:https?:\/\/|mailto:)/i;
|
|
2799
|
+
var SAFE_IMAGE = /^(?:https?:\/\/|mailto:|data:image\/|\.{0,2}\/)/i;
|
|
2800
|
+
markdown.validateLink = (url) => SAFE_LINK.test(url) || SAFE_IMAGE.test(url);
|
|
2801
|
+
markdown.renderer.rules.link_open = (tokens, index, options, _env, self) => {
|
|
2802
|
+
tokens[index]?.attrSet("rel", "noopener noreferrer nofollow");
|
|
2803
|
+
return self.renderToken(tokens, index, options);
|
|
2804
|
+
};
|
|
2805
|
+
markdown.renderer.rules.image = (tokens, index) => markdown.utils.escapeHtml(String(tokens[index]?.content ?? ""));
|
|
2806
|
+
markdown.core.ruler.push("tolkira_link_policy", (state) => {
|
|
2807
|
+
for (const token of state.tokens) {
|
|
2808
|
+
const children = token.children;
|
|
2809
|
+
if (!children) continue;
|
|
2810
|
+
const stack = [];
|
|
2811
|
+
const suppressed = /* @__PURE__ */ new Set();
|
|
2812
|
+
for (let index = 0; index < children.length; index += 1) {
|
|
2813
|
+
const child = children[index];
|
|
2814
|
+
if (!child) continue;
|
|
2815
|
+
if (child.type === "link_open") {
|
|
2816
|
+
const href = String(child.attrGet("href") ?? "");
|
|
2817
|
+
stack.push({ open: index, safe: SAFE_LINK.test(href), image: false });
|
|
2818
|
+
} else if (child.type === "image" && stack.length > 0) {
|
|
2819
|
+
const link = stack[stack.length - 1];
|
|
2820
|
+
if (link) link.image = true;
|
|
2821
|
+
} else if (child.type === "link_close") {
|
|
2822
|
+
const link = stack.pop();
|
|
2823
|
+
if (link && (!link.safe || link.image)) {
|
|
2824
|
+
suppressed.add(link.open);
|
|
2825
|
+
suppressed.add(index);
|
|
2826
|
+
}
|
|
2827
|
+
}
|
|
2828
|
+
}
|
|
2829
|
+
if (suppressed.size > 0) {
|
|
2830
|
+
token.children = children.filter((_, index) => !suppressed.has(index));
|
|
2831
|
+
}
|
|
2832
|
+
}
|
|
2833
|
+
});
|
|
2834
|
+
var HEADING_LEVELS = {
|
|
2835
|
+
h1: "h3",
|
|
2836
|
+
h2: "h4",
|
|
2837
|
+
h3: "h4",
|
|
2838
|
+
h4: "h4",
|
|
2839
|
+
h5: "h4",
|
|
2840
|
+
h6: "h4"
|
|
2841
|
+
};
|
|
2842
|
+
for (const type of ["heading_open", "heading_close"]) {
|
|
2843
|
+
const defaultRule = markdown.renderer.rules[type];
|
|
2844
|
+
markdown.renderer.rules[type] = (tokens, index, options, env, self) => {
|
|
2845
|
+
const token = tokens[index];
|
|
2846
|
+
if (token) {
|
|
2847
|
+
token.tag = HEADING_LEVELS[token.tag] ?? token.tag;
|
|
2848
|
+
}
|
|
2849
|
+
return defaultRule ? defaultRule(tokens, index, options, env, self) : self.renderToken(tokens, index, options);
|
|
2850
|
+
};
|
|
2851
|
+
}
|
|
2852
|
+
markdown.renderer.rules.table_open = () => '<div class="tableWrap" tabindex="0" role="region" aria-label="Description table"><table>';
|
|
2853
|
+
markdown.renderer.rules.table_close = () => "</table></div>";
|
|
2854
|
+
function renderDescription(description) {
|
|
2855
|
+
if (!description || !description.trim()) return "";
|
|
2856
|
+
return `<div class="description">${markdown.render(description)}</div>`;
|
|
2857
|
+
}
|
|
2858
|
+
|
|
2255
2859
|
// src/render/styles.ts
|
|
2256
2860
|
var REPORT_CSS = `:root {
|
|
2257
2861
|
color-scheme: light;
|
|
@@ -2286,6 +2890,22 @@ var REPORT_CSS = `:root {
|
|
|
2286
2890
|
--radius: 10px;
|
|
2287
2891
|
--radius-control: 6px;
|
|
2288
2892
|
--shadow: none;
|
|
2893
|
+
--ansi-fg-0: #24292f;
|
|
2894
|
+
--ansi-fg-1: #b91c1c;
|
|
2895
|
+
--ansi-fg-2: #15803d;
|
|
2896
|
+
--ansi-fg-3: #965c05;
|
|
2897
|
+
--ansi-fg-4: #1d4ed8;
|
|
2898
|
+
--ansi-fg-5: #a21caf;
|
|
2899
|
+
--ansi-fg-6: #0e7490;
|
|
2900
|
+
--ansi-fg-7: #4b5563;
|
|
2901
|
+
--ansi-fg-8: #5b6673;
|
|
2902
|
+
--ansi-fg-9: #d11f1f;
|
|
2903
|
+
--ansi-fg-10: #0f7d38;
|
|
2904
|
+
--ansi-fg-11: #906000;
|
|
2905
|
+
--ansi-fg-12: #2563eb;
|
|
2906
|
+
--ansi-fg-13: #b01ec0;
|
|
2907
|
+
--ansi-fg-14: #0a7697;
|
|
2908
|
+
--ansi-fg-15: #111827;
|
|
2289
2909
|
}
|
|
2290
2910
|
* { box-sizing: border-box; }
|
|
2291
2911
|
html { background: var(--paper); scroll-padding-top: 4.5rem; scrollbar-gutter: stable; }
|
|
@@ -2403,6 +3023,39 @@ img, video { max-width: 100%; height: auto; }
|
|
|
2403
3023
|
.chev { width: 1rem; height: 1rem; justify-self: end; background: currentColor; color: var(--muted); mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 6l4 4 4-4' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 1rem no-repeat; transition: transform 220ms cubic-bezier(0.16, 1, 0.3, 1); }
|
|
2404
3024
|
details[open] > summary .chev { transform: rotate(180deg); }
|
|
2405
3025
|
.rows { border-top: 1px solid var(--line); }
|
|
3026
|
+
.rule { padding: 0.75rem 0 0.25rem; border-top: 1px solid var(--line); }
|
|
3027
|
+
.ruleTitle { margin: 0.25rem 0 0; font-size: 0.9375rem; line-height: 1.35; font-weight: 600; overflow-wrap: anywhere; }
|
|
3028
|
+
.ruleTitle .kw, .backgroundTitle .kw { color: var(--muted); font-weight: 500; }
|
|
3029
|
+
.rule > .tags { margin: 0.5rem 0 0; }
|
|
3030
|
+
.ruleRows { margin-top: 0.25rem; }
|
|
3031
|
+
.background { margin: 0.5rem 0 0; padding: 0.5rem 0.75rem; border-left: 2px solid var(--line); background: var(--surface-2); }
|
|
3032
|
+
.feature > .background { margin: 0.75rem 0 0; }
|
|
3033
|
+
.backgroundTitle { margin: 0; font-size: 0.8125rem; line-height: 1.35; font-weight: 500; overflow-wrap: anywhere; }
|
|
3034
|
+
.background > .description { margin-top: 0.25rem; font-size: 0.8125rem; }
|
|
3035
|
+
.featureShape .featureTags { flex-basis: 100%; margin-top: 0; }
|
|
3036
|
+
.outline { padding: 0.75rem 0 0.25rem; }
|
|
3037
|
+
.outline + .outline { border-top: 1px solid var(--line); }
|
|
3038
|
+
.outlineTitle { margin: 0.25rem 0 0; font-size: 0.9375rem; line-height: 1.35; font-weight: 600; overflow-wrap: anywhere; }
|
|
3039
|
+
.examplesTitle { margin: 0.5rem 0 0.25rem; font-size: 0.875rem; line-height: 1.35; font-weight: 500; overflow-wrap: anywhere; }
|
|
3040
|
+
.outlineTitle .kw, .examplesTitle .kw { color: var(--muted); font-weight: 500; }
|
|
3041
|
+
.outline > .tags, .examples > .tags { margin: 0.5rem 0 0; }
|
|
3042
|
+
.outline > .description, .examples > .description { margin-top: 0.375rem; }
|
|
3043
|
+
.examples { margin: 0.75rem 0 0 0.75rem; padding-left: 0.875rem; border-left: 2px solid var(--line); }
|
|
3044
|
+
.exampleRows { margin-top: 0.25rem; }
|
|
3045
|
+
.exampleRows .scenario { border-top: 1px solid var(--line); }
|
|
3046
|
+
.exampleRows .scenario:last-child { border-bottom: 0; }
|
|
3047
|
+
.exampleNo { color: var(--accent-text); font-family: var(--font-mono); font-size: 0.8125rem; font-weight: 500; }
|
|
3048
|
+
.detailLabel { margin: 0.875rem 0 0.375rem; color: var(--muted); font-size: 0.8125rem; font-weight: 600; }
|
|
3049
|
+
.hooks { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
|
|
3050
|
+
.hook { display: grid; grid-template-columns: 0.875rem minmax(0, 1fr) auto; gap: 0.5rem; padding: 0.4375rem 0; border-bottom: 1px solid var(--line); font-size: 0.8125rem; }
|
|
3051
|
+
.hook:last-child { border-bottom: 0; }
|
|
3052
|
+
.hookLabel { color: var(--ink-2); font-weight: 500; overflow-wrap: anywhere; }
|
|
3053
|
+
.hookGroup { margin: 0.5rem 0; border: 1px solid var(--line); border-radius: 5px; padding: 0.375rem 0.5625rem; background: var(--surface-2); }
|
|
3054
|
+
.hookGroup > summary { cursor: pointer; color: var(--accent-text); font-size: 0.75rem; }
|
|
3055
|
+
.hookGroup .hooks { margin-top: 0.375rem; }
|
|
3056
|
+
.runHooks { margin: 1.5rem 0; padding: 1rem 1.25rem; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface-2); }
|
|
3057
|
+
.runHooks h2 { margin: 0 0 0.5rem; font-size: 1.125rem; }
|
|
3058
|
+
.runHooks .hooks { border-top: 1px solid var(--line); }
|
|
2406
3059
|
.scenario { border-bottom: 1px solid var(--line); container-type: inline-size; }
|
|
2407
3060
|
.scenario:last-child { border-bottom: 0; }
|
|
2408
3061
|
.scenarioButton { width: 100%; display: grid; grid-template-columns: minmax(5.5rem, max-content) 6rem minmax(0, 1fr) auto 1.25rem; gap: 0.75rem; align-items: center; padding: 0.75rem 0; border: 0; background: transparent; color: inherit; text-align: left; list-style: none; cursor: pointer; }
|
|
@@ -2417,11 +3070,27 @@ details[open] > summary.scenarioButton { background: var(--surface-2); }
|
|
|
2417
3070
|
.thumb { display: block; width: 6rem; height: 3.75rem; object-fit: cover; border: 1px solid var(--line-strong); border-radius: 5px; background: var(--surface-3); }
|
|
2418
3071
|
.rowRight { color: var(--muted); font-family: var(--font-mono); font-size: 0.75rem; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
|
|
2419
3072
|
.detailInline { padding: 0.25rem 0 1.125rem 13rem; background: var(--surface-2); border-top: 1px solid var(--line); }
|
|
2420
|
-
.detailInline h4 { margin: 0.875rem 0 0.375rem; color: var(--muted); font-size: 0.8125rem; font-weight: 600; }
|
|
2421
3073
|
.stepsHead { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 0.75rem; }
|
|
2422
3074
|
.copyFailure { min-height: 1.75rem; padding: 0 0.5625rem; border: 1px solid var(--line-strong); border-radius: var(--radius-control); background: var(--paper); color: var(--ink-2); font-size: 0.6875rem; }
|
|
2423
3075
|
.copyFailure:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--ink); }
|
|
2424
|
-
.description { margin: 0.625rem 0 0; color: var(--muted); font-size: 0.875rem; line-height: 1.55;
|
|
3076
|
+
.description { margin: 0.625rem 0 0; color: var(--muted); font-size: 0.875rem; line-height: 1.55; }
|
|
3077
|
+
.description > :first-child { margin-top: 0; }
|
|
3078
|
+
.description > :last-child { margin-bottom: 0; }
|
|
3079
|
+
.description p { margin: 0.5rem 0 0; }
|
|
3080
|
+
.description h3, .description h4 { margin: 0.75rem 0 0.25rem; color: var(--ink); line-height: 1.35; font-weight: 600; }
|
|
3081
|
+
.description h3 { font-size: 1rem; }
|
|
3082
|
+
.description h4 { font-size: 0.9375rem; }
|
|
3083
|
+
.description ul, .description ol { margin: 0.5rem 0 0; padding-left: 1.25rem; }
|
|
3084
|
+
.description li + li { margin-top: 0.125rem; }
|
|
3085
|
+
.description blockquote { margin: 0.5rem 0 0; padding: 0.125rem 0 0.125rem 0.75rem; border-left: 2px solid var(--line-strong); }
|
|
3086
|
+
.description code { padding: 0.05rem 0.25rem; border-radius: 4px; background: var(--surface-3); color: var(--ink-2); font: 0.8125em/1.4 var(--font-mono); }
|
|
3087
|
+
.description pre { margin: 0.5rem 0 0; padding: 0.5rem 0.625rem; border: 1px solid var(--line); border-radius: 5px; background: var(--surface-3); overflow-x: auto; }
|
|
3088
|
+
.description pre code { padding: 0; background: transparent; }
|
|
3089
|
+
.description a { color: var(--accent-text); }
|
|
3090
|
+
.description .tableWrap { margin-top: 0.5rem; }
|
|
3091
|
+
.description table { border-collapse: collapse; background: var(--surface-2); font-size: 0.8125rem; }
|
|
3092
|
+
.description th, .description td { border: 1px solid var(--line); padding: 0.25rem 0.5rem; text-align: left; }
|
|
3093
|
+
.description th { color: var(--muted); font-weight: 600; background: var(--surface-3); }
|
|
2425
3094
|
.steps { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
|
|
2426
3095
|
.step { display: grid; grid-template-columns: 0.875rem minmax(0, 1fr) auto; gap: 0.5rem; padding: 0.4375rem 0; border-bottom: 1px solid var(--line); font-size: 0.8125rem; }
|
|
2427
3096
|
.step:last-child { border-bottom: 0; }
|
|
@@ -2431,7 +3100,19 @@ details[open] > summary.scenarioButton { background: var(--surface-2); }
|
|
|
2431
3100
|
.marker { width: 0.375rem; height: 0.375rem; border-radius: 1px; background: var(--line-strong); }
|
|
2432
3101
|
.marker.pass { background: var(--pass); } .marker.fail { background: var(--fail); } .marker.pending { background: var(--pending); } .marker.undefined { background: var(--undefined); } .marker.ambiguous, .marker.skipped, .marker.unknown { background: var(--muted); }
|
|
2433
3102
|
.step .kw { color: var(--muted); }
|
|
3103
|
+
.step .param { color: var(--accent-text); font-weight: 500; }
|
|
2434
3104
|
.step .dur { color: var(--accent-text); font-family: var(--font-mono); font-size: 0.6875rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
|
|
3105
|
+
.diagnostic { margin: 0.375rem 0 0.125rem; padding: 0.5rem 0.625rem; border: 1px solid var(--line); border-left: 3px solid var(--undefined); border-radius: 5px; background: var(--undefined-soft); }
|
|
3106
|
+
.diagnostic[data-diagnostic="ambiguous"] { border-left-color: var(--ambiguous); background: var(--surface-3); }
|
|
3107
|
+
.diagnosticLead { margin: 0; color: var(--ink-2); font-size: 0.75rem; }
|
|
3108
|
+
.snippet { margin: 0.375rem 0 0; min-width: 0; }
|
|
3109
|
+
.snippetLang { display: block; color: var(--muted); font-family: var(--font-mono); font-size: 0.625rem; }
|
|
3110
|
+
.snippet pre { margin: 0.125rem 0 0; padding: 0.5rem 0.625rem; border: 1px solid var(--line); border-radius: 5px; background: var(--paper); color: var(--ink); font: 0.6875rem/1.5 var(--font-mono); white-space: pre-wrap; overflow-wrap: anywhere; }
|
|
3111
|
+
.snippet code { font: inherit; }
|
|
3112
|
+
.definitions { display: grid; gap: 0.25rem; margin: 0.375rem 0 0; padding: 0; list-style: none; }
|
|
3113
|
+
.definitions li { display: grid; gap: 0.125rem; min-width: 0; padding: 0.375rem 0.5rem; border: 1px solid var(--line); border-radius: 5px; background: var(--paper); }
|
|
3114
|
+
.definitionPattern { font: 0.6875rem/1.5 var(--font-mono); overflow-wrap: anywhere; }
|
|
3115
|
+
.definitionSource { color: var(--muted); font-family: var(--font-mono); font-size: 0.625rem; overflow-wrap: anywhere; }
|
|
2435
3116
|
.error { margin: 0.375rem 0 0.125rem; padding: 0.5rem 0.625rem; border: 1px solid color-mix(in oklab, var(--fail) 24%, var(--line)); border-radius: 5px; background: var(--fail-soft); color: var(--fail); font: 0.6875rem/1.5 var(--font-mono); white-space: pre-wrap; overflow-wrap: anywhere; }
|
|
2436
3117
|
.docString { margin: 0.375rem 0 0.125rem; padding: 0.5rem 0.625rem; border: 1px solid var(--line); border-radius: 5px; background: var(--surface-3); color: var(--ink-2); font: 0.6875rem/1.5 var(--font-mono); white-space: pre-wrap; overflow-wrap: anywhere; }
|
|
2437
3118
|
.tableWrap { max-width: 100%; overflow-x: auto; overscroll-behavior-x: contain; }
|
|
@@ -2451,6 +3132,25 @@ details[open] > summary.scenarioButton { background: var(--surface-2); }
|
|
|
2451
3132
|
.attachmentText { margin: 0.5rem 0; border: 1px solid var(--line); border-radius: 6px; padding: 0.4375rem 0.5625rem; background: var(--surface-2); }
|
|
2452
3133
|
.attachmentText summary { cursor: pointer; color: var(--accent-text); font-size: 0.75rem; }
|
|
2453
3134
|
.attachmentText pre { margin: 0.5rem 0 0; white-space: pre-wrap; overflow-wrap: anywhere; font: 0.6875rem/1.45 var(--font-mono); color: var(--ink); }
|
|
3135
|
+
.logTools { display: flex; justify-content: flex-end; margin-top: 0.5rem; }
|
|
3136
|
+
.copyLog { min-height: 1.75rem; padding: 0 0.5625rem; border: 1px solid var(--line-strong); border-radius: var(--radius-control); background: var(--paper); color: var(--ink-2); font-size: 0.6875rem; }
|
|
3137
|
+
.copyLog:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--ink); }
|
|
3138
|
+
.ansi { white-space: pre-wrap; }
|
|
3139
|
+
.ansi-bold { font-weight: 700; }
|
|
3140
|
+
.ansi-dim { opacity: 0.65; }
|
|
3141
|
+
.ansi-italic { font-style: italic; }
|
|
3142
|
+
.ansi-underline { text-decoration: underline; }
|
|
3143
|
+
.ansi-fg-0 { color: var(--ansi-fg-0); } .ansi-fg-1 { color: var(--ansi-fg-1); } .ansi-fg-2 { color: var(--ansi-fg-2); } .ansi-fg-3 { color: var(--ansi-fg-3); }
|
|
3144
|
+
.ansi-fg-4 { color: var(--ansi-fg-4); } .ansi-fg-5 { color: var(--ansi-fg-5); } .ansi-fg-6 { color: var(--ansi-fg-6); } .ansi-fg-7 { color: var(--ansi-fg-7); }
|
|
3145
|
+
.ansi-fg-8 { color: var(--ansi-fg-8); } .ansi-fg-9 { color: var(--ansi-fg-9); } .ansi-fg-10 { color: var(--ansi-fg-10); } .ansi-fg-11 { color: var(--ansi-fg-11); }
|
|
3146
|
+
.ansi-fg-12 { color: var(--ansi-fg-12); } .ansi-fg-13 { color: var(--ansi-fg-13); } .ansi-fg-14 { color: var(--ansi-fg-14); } .ansi-fg-15 { color: var(--ansi-fg-15); }
|
|
3147
|
+
.ansi-bg-0 { background-color: color-mix(in oklab, var(--ansi-fg-0) 26%, var(--paper)); } .ansi-bg-1 { background-color: color-mix(in oklab, var(--ansi-fg-1) 26%, var(--paper)); } .ansi-bg-2 { background-color: color-mix(in oklab, var(--ansi-fg-2) 26%, var(--paper)); } .ansi-bg-3 { background-color: color-mix(in oklab, var(--ansi-fg-3) 26%, var(--paper)); }
|
|
3148
|
+
.ansi-bg-4 { background-color: color-mix(in oklab, var(--ansi-fg-4) 26%, var(--paper)); } .ansi-bg-5 { background-color: color-mix(in oklab, var(--ansi-fg-5) 26%, var(--paper)); } .ansi-bg-6 { background-color: color-mix(in oklab, var(--ansi-fg-6) 26%, var(--paper)); } .ansi-bg-7 { background-color: color-mix(in oklab, var(--ansi-fg-7) 26%, var(--paper)); }
|
|
3149
|
+
.ansi-bg-8 { background-color: color-mix(in oklab, var(--ansi-fg-8) 26%, var(--paper)); } .ansi-bg-9 { background-color: color-mix(in oklab, var(--ansi-fg-9) 26%, var(--paper)); } .ansi-bg-10 { background-color: color-mix(in oklab, var(--ansi-fg-10) 26%, var(--paper)); } .ansi-bg-11 { background-color: color-mix(in oklab, var(--ansi-fg-11) 26%, var(--paper)); }
|
|
3150
|
+
.ansi-bg-12 { background-color: color-mix(in oklab, var(--ansi-fg-12) 26%, var(--paper)); } .ansi-bg-13 { background-color: color-mix(in oklab, var(--ansi-fg-13) 26%, var(--paper)); } .ansi-bg-14 { background-color: color-mix(in oklab, var(--ansi-fg-14) 26%, var(--paper)); } .ansi-bg-15 { background-color: color-mix(in oklab, var(--ansi-fg-15) 26%, var(--paper)); }
|
|
3151
|
+
.ansi-bg-only { color: var(--ink); }
|
|
3152
|
+
.ansi-inline-fg { color: color-mix(in oklab, var(--ansi-fg) 30%, var(--ink)); }
|
|
3153
|
+
.ansi-inline-bg { background-color: color-mix(in oklab, var(--ansi-bg) 26%, var(--paper)); }
|
|
2454
3154
|
.fileLink { display: inline-block; margin: 0.3125rem 0; color: var(--accent-text); font-size: 0.75rem; }
|
|
2455
3155
|
.meta span, .path, .description, .step, .featureSource, .featureUri, .fileLink, .attachment figcaption, .attachmentText summary, .detailMeta span { overflow-wrap: anywhere; }
|
|
2456
3156
|
.detailMeta { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; margin-top: 0.75rem; color: var(--muted); font-size: 0.6875rem; font-variant-numeric: tabular-nums; }
|
|
@@ -2515,6 +3215,7 @@ details[open] > summary.scenarioButton { background: var(--surface-2); }
|
|
|
2515
3215
|
.thumb { width: 2.5rem; height: 1.875rem; }
|
|
2516
3216
|
.statusText { min-width: 3.125rem; }
|
|
2517
3217
|
.filter { min-height: 1.75rem; }
|
|
3218
|
+
.examples { margin-left: 0; padding-left: 0.625rem; }
|
|
2518
3219
|
.matrixHint { display: block; margin: 0 0 0.5rem; font-size: 0.75rem; }
|
|
2519
3220
|
.triageBox > summary { display: flex; flex-wrap: wrap; padding: 0.875rem 1rem; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface-2); cursor: pointer; }
|
|
2520
3221
|
.triageBox .triage { margin: 0.5rem 0 0; }
|
|
@@ -2523,6 +3224,7 @@ details[open] > summary.scenarioButton { background: var(--surface-2); }
|
|
|
2523
3224
|
}
|
|
2524
3225
|
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
|
|
2525
3226
|
@container (max-width: 16rem) {
|
|
3227
|
+
.thumb { display: none; }
|
|
2526
3228
|
.runHead h1 { font-size: 1.3rem; }
|
|
2527
3229
|
.feature > summary { grid-template-columns: auto 1fr auto; grid-template-areas: "status . chev" "title title title" "shape shape shape"; gap: 0.5rem; }
|
|
2528
3230
|
.feature > summary .statusCell { grid-area: status; }
|
|
@@ -2573,6 +3275,22 @@ details[open] > summary.scenarioButton { background: var(--surface-2); }
|
|
|
2573
3275
|
--skipped-soft: oklch(21% 0.009 60);
|
|
2574
3276
|
--unknown: oklch(71% 0.012 85);
|
|
2575
3277
|
--unknown-soft: oklch(21% 0.009 60);
|
|
3278
|
+
--ansi-fg-0: #9ca3af;
|
|
3279
|
+
--ansi-fg-1: #f87171;
|
|
3280
|
+
--ansi-fg-2: #86efac;
|
|
3281
|
+
--ansi-fg-3: #fde047;
|
|
3282
|
+
--ansi-fg-4: #93c5fd;
|
|
3283
|
+
--ansi-fg-5: #f0abfc;
|
|
3284
|
+
--ansi-fg-6: #67e8f9;
|
|
3285
|
+
--ansi-fg-7: #e5e7eb;
|
|
3286
|
+
--ansi-fg-8: #9ca3af;
|
|
3287
|
+
--ansi-fg-9: #fca5a5;
|
|
3288
|
+
--ansi-fg-10: #4ade80;
|
|
3289
|
+
--ansi-fg-11: #facc15;
|
|
3290
|
+
--ansi-fg-12: #60a5fa;
|
|
3291
|
+
--ansi-fg-13: #e879f9;
|
|
3292
|
+
--ansi-fg-14: #22d3ee;
|
|
3293
|
+
--ansi-fg-15: #ffffff;
|
|
2576
3294
|
}
|
|
2577
3295
|
}
|
|
2578
3296
|
`;
|
|
@@ -2622,6 +3340,8 @@ var TRIAGE_FEATURE_LIMIT = 20;
|
|
|
2622
3340
|
var TRIAGE_SCENARIO_LIMIT = 3;
|
|
2623
3341
|
var SOURCE_LIMIT = 6;
|
|
2624
3342
|
var SEARCH_MESSAGE_LIMIT = 2e3;
|
|
3343
|
+
var UNDEFINED_LEAD = "No step definition found.";
|
|
3344
|
+
var AMBIGUOUS_LEAD = "Multiple matching step definitions found:";
|
|
2625
3345
|
function compareStatus(a, b) {
|
|
2626
3346
|
const passed = Number(a === "passed") - Number(b === "passed");
|
|
2627
3347
|
return passed !== 0 ? passed : statusSeverity(b) - statusSeverity(a);
|
|
@@ -2645,74 +3365,88 @@ function countStatuses(scenarios) {
|
|
|
2645
3365
|
}
|
|
2646
3366
|
return counts;
|
|
2647
3367
|
}
|
|
3368
|
+
function executedOnly(scenarios) {
|
|
3369
|
+
return scenarios.filter((scenario) => scenario.executed);
|
|
3370
|
+
}
|
|
2648
3371
|
function barWidth(count2, total) {
|
|
2649
3372
|
return total === 0 ? 0 : Math.round(count2 / total * 1e3) / 10;
|
|
2650
3373
|
}
|
|
2651
3374
|
function attentionCounts(scenarios) {
|
|
2652
3375
|
const counts = /* @__PURE__ */ new Map();
|
|
2653
3376
|
for (const scenario of scenarios) {
|
|
2654
|
-
if (scenario.status === "passed") continue;
|
|
3377
|
+
if (!scenario.executed || scenario.status === "passed") continue;
|
|
2655
3378
|
counts.set(scenario.status, (counts.get(scenario.status) ?? 0) + 1);
|
|
2656
3379
|
}
|
|
2657
3380
|
return [...counts.entries()].sort((a, b) => statusSeverity(b[0]) - statusSeverity(a[0])).map(([status, count2]) => `${count2} ${status}`).join(", ");
|
|
2658
3381
|
}
|
|
2659
3382
|
function featureBar(scenarios) {
|
|
2660
|
-
const
|
|
3383
|
+
const executed = executedOnly(scenarios);
|
|
3384
|
+
const total = executed.length;
|
|
2661
3385
|
if (total === 0) return "";
|
|
2662
|
-
const counts = countStatuses(
|
|
3386
|
+
const counts = countStatuses(executed);
|
|
2663
3387
|
const segments = ALL_STATUSES.filter((status) => counts[status]).map(
|
|
2664
3388
|
(status) => `<i class="${statusClass(status)}" style="width:${barWidth(counts[status] ?? 0, total)}%"></i>`
|
|
2665
3389
|
).join("");
|
|
2666
3390
|
return `<span class="bar" aria-hidden="true">${segments}</span>`;
|
|
2667
3391
|
}
|
|
2668
3392
|
function featureShape(feature, scenarios) {
|
|
2669
|
-
const
|
|
3393
|
+
const executed = executedOnly(scenarios);
|
|
3394
|
+
const passed = executed.filter(
|
|
2670
3395
|
(scenario) => scenario.status === "passed"
|
|
2671
3396
|
).length;
|
|
2672
|
-
const attention = attentionCounts(
|
|
2673
|
-
const counts = `${passed} of ${
|
|
3397
|
+
const attention = attentionCounts(executed);
|
|
3398
|
+
const counts = `${passed} of ${executed.length} passed${attention ? ` \xB7 ${attention}` : ""}`;
|
|
2674
3399
|
const source = feature.sourceFile ? `<span class="featureSource">from ${escapeHtml(feature.sourceFile)}</span>` : "";
|
|
2675
|
-
return `<span class="featureShape"><span class="featureCounts">${counts}</span>${featureBar(scenarios)}${source}<span class="featureUri">${escapeHtml(displayUri(feature.uri))}</span
|
|
3400
|
+
return `<span class="featureShape"><span class="featureCounts">${counts}</span>${featureBar(scenarios)}${source}<span class="featureUri">${escapeHtml(displayUri(feature.uri))}</span>${tagsMarkup(feature.tags, "featureTags")}</span>`;
|
|
2676
3401
|
}
|
|
2677
3402
|
function renderTriageRow({
|
|
2678
3403
|
feature,
|
|
2679
3404
|
scenarios,
|
|
2680
3405
|
index
|
|
2681
3406
|
}) {
|
|
2682
|
-
const failing = scenarios.filter(
|
|
3407
|
+
const failing = executedOnly(scenarios).filter(
|
|
2683
3408
|
(scenario) => scenario.status !== "passed"
|
|
2684
3409
|
);
|
|
2685
3410
|
const links = failing.slice(0, TRIAGE_SCENARIO_LIMIT).map((scenario) => {
|
|
2686
3411
|
const scenarioIndex = scenarios.indexOf(scenario) + 1;
|
|
2687
|
-
return `<li><a class="triageScenario" href="#scenario-${index + 1}-${scenarioIndex}"><span class="triageStatus ${statusClass(scenario.status)}">${statusLabel(scenario.status)}</span><span>${escapeHtml(scenario
|
|
3412
|
+
return `<li><a class="triageScenario" href="#scenario-${index + 1}-${scenarioIndex}"><span class="triageStatus ${statusClass(scenario.status)}">${statusLabel(scenario.status)}</span><span>${escapeHtml(scenarioLabel(scenario))}</span></a></li>`;
|
|
2688
3413
|
}).join("");
|
|
2689
3414
|
const more = failing.length > TRIAGE_SCENARIO_LIMIT ? `<li class="triageMore">+${failing.length - TRIAGE_SCENARIO_LIMIT} more in the report</li>` : "";
|
|
2690
|
-
const failed =
|
|
3415
|
+
const failed = failing.find((scenario) => scenario.status === "failed");
|
|
2691
3416
|
const failedStep = failed?.steps.find(
|
|
2692
3417
|
(step) => step.status === "failed" && step.message
|
|
2693
3418
|
);
|
|
2694
|
-
const
|
|
3419
|
+
const failedHook = failed?.hooks.find(
|
|
3420
|
+
(hook) => hook.status === "failed" && hook.message
|
|
3421
|
+
);
|
|
3422
|
+
const reasonSource = failedStep?.message ? `${failedStep.keyword ? `${failedStep.keyword} ` : ""}${failedStep.text}` : failedHook?.message ? hookLabel2(failedHook) : "";
|
|
3423
|
+
const reasonMessage = failedStep?.message ?? failedHook?.message ?? "";
|
|
3424
|
+
const reason = reasonSource ? `${reasonSource} \u2014 ${reasonMessage.split(/\r?\n/)[0].trim().slice(0, 120)}${reasonMessage.split(/\r?\n/)[0].trim().length > 120 ? "\u2026" : ""}` : "";
|
|
2695
3425
|
return `<li class="triageItem"><a class="triageFeature" href="#feature-${index + 1}" title="${escapeHtml(displayUri(feature.uri))}"><span class="triageStatus ${statusClass(feature.status)}">${statusLabel(feature.status)}</span><span>${escapeHtml(feature.name)}</span></a><p class="triageCounts">${attentionCounts(scenarios)}</p><ul class="triageScenarios">${links}${more}</ul>${reason ? `<p class="triageReason"><span class="triageReasonLabel">First failure:</span> ${escapeHtml(reason)}</p>` : ""}</li>`;
|
|
2696
3426
|
}
|
|
2697
3427
|
function renderTriage(features) {
|
|
2698
3428
|
const attention = features.map((entry, index) => ({ ...entry, index })).filter(
|
|
2699
|
-
({ scenarios }) => scenarios.some(
|
|
3429
|
+
({ scenarios }) => scenarios.some(
|
|
3430
|
+
(scenario) => scenario.executed && scenario.status !== "passed"
|
|
3431
|
+
)
|
|
2700
3432
|
);
|
|
2701
3433
|
if (attention.length === 0) return "";
|
|
2702
3434
|
const shown = attention.slice(0, 5);
|
|
2703
3435
|
const rest = attention.slice(5, TRIAGE_FEATURE_LIMIT);
|
|
2704
3436
|
const total = features.reduce(
|
|
2705
|
-
(sum, entry) => sum + entry.scenarios.length,
|
|
3437
|
+
(sum, entry) => sum + executedOnly(entry.scenarios).length,
|
|
2706
3438
|
0
|
|
2707
3439
|
);
|
|
2708
3440
|
const need = attention.reduce(
|
|
2709
|
-
(sum, entry) => sum + entry.scenarios.filter(
|
|
3441
|
+
(sum, entry) => sum + entry.scenarios.filter(
|
|
3442
|
+
(scenario) => scenario.executed && scenario.status !== "passed"
|
|
3443
|
+
).length,
|
|
2710
3444
|
0
|
|
2711
3445
|
);
|
|
2712
3446
|
const rows = shown.map(renderTriageRow).join("");
|
|
2713
3447
|
const restBlock = rest.length ? `<details class="triageRest"><summary>Show ${rest.length} more feature${rest.length === 1 ? "" : "s"}</summary><ol class="triageList">${rest.map(renderTriageRow).join("")}</ol></details>` : "";
|
|
2714
3448
|
const remainder = attention.length > TRIAGE_FEATURE_LIMIT ? `<p class="triageMore">${attention.length - TRIAGE_FEATURE_LIMIT} more feature${attention.length - TRIAGE_FEATURE_LIMIT === 1 ? "" : "s"} below.</p>` : "";
|
|
2715
|
-
const lead = `${need} of ${total} scenario${total === 1 ? "" : "s"} ${
|
|
3449
|
+
const lead = `${need} of ${total} scenario${total === 1 ? "" : "s"} ${total === 1 ? "needs" : "need"} attention.`;
|
|
2716
3450
|
return `<details class="triageBox" data-triage open><summary class="triageSummary"><span class="triageTitle">Needs attention</span><span class="triageSummaryLead">${lead}</span><span class="chev" aria-hidden="true"></span></summary><nav class="triage" aria-label="Needs attention"><h2 id="triage-heading">Needs attention</h2><p class="triageLead">${lead}</p><ol class="triageList">${rows}</ol>${restBlock}${remainder}</nav></details>`;
|
|
2717
3451
|
}
|
|
2718
3452
|
function renderSourceStrip(model) {
|
|
@@ -2726,13 +3460,18 @@ function renderSourceStrip(model) {
|
|
|
2726
3460
|
groups.set(file, group);
|
|
2727
3461
|
});
|
|
2728
3462
|
if (groups.size < 2) return "";
|
|
2729
|
-
const entries = [...groups.entries()].map(([file, group]) =>
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
|
|
3463
|
+
const entries = [...groups.entries()].map(([file, group]) => {
|
|
3464
|
+
const scenarios = executedOnly(
|
|
3465
|
+
group.features.flatMap((feature) => feature.scenarios)
|
|
3466
|
+
);
|
|
3467
|
+
return {
|
|
3468
|
+
file,
|
|
3469
|
+
features: group.features.length,
|
|
3470
|
+
scenarios,
|
|
3471
|
+
status: worstExecutedStatus(scenarios),
|
|
3472
|
+
order: group.order
|
|
3473
|
+
};
|
|
3474
|
+
});
|
|
2736
3475
|
entries.sort((a, b) => {
|
|
2737
3476
|
const status = compareStatus(a.status, b.status);
|
|
2738
3477
|
return status !== 0 ? status : a.order - b.order;
|
|
@@ -2760,6 +3499,179 @@ function countPills(model) {
|
|
|
2760
3499
|
(status) => `<span class="${statusClass(status)}"><b>${counts[status]}</b> ${status}</span>`
|
|
2761
3500
|
).join("")}</div>`;
|
|
2762
3501
|
}
|
|
3502
|
+
function safeHttpUrl(value) {
|
|
3503
|
+
const trimmed = stripBidiControls(value ?? "").trim();
|
|
3504
|
+
if (!trimmed) return void 0;
|
|
3505
|
+
try {
|
|
3506
|
+
const url = new URL(trimmed);
|
|
3507
|
+
return url.protocol === "http:" || url.protocol === "https:" ? url.href : void 0;
|
|
3508
|
+
} catch {
|
|
3509
|
+
return void 0;
|
|
3510
|
+
}
|
|
3511
|
+
}
|
|
3512
|
+
function githubRepoPath(url) {
|
|
3513
|
+
if (url.hostname.toLowerCase() !== "github.com") return void 0;
|
|
3514
|
+
const path3 = url.pathname.replace(/\/+$/, "").replace(/\.git$/i, "");
|
|
3515
|
+
return /^\/[^/]+\/[^/]+$/.test(path3) ? path3 : void 0;
|
|
3516
|
+
}
|
|
3517
|
+
function githubBaseUrl(remote) {
|
|
3518
|
+
const value = stripBidiControls(remote ?? "").trim();
|
|
3519
|
+
if (!value) return void 0;
|
|
3520
|
+
const direct = safeHttpUrl(value);
|
|
3521
|
+
if (direct) {
|
|
3522
|
+
const url = new URL(direct);
|
|
3523
|
+
const path3 = githubRepoPath(url);
|
|
3524
|
+
return path3 ? `${url.origin}${path3}` : void 0;
|
|
3525
|
+
}
|
|
3526
|
+
const scp = /^(?:[^@\s/:]+@)?github\.com:([^/\s]+)\/([^/\s]+?)(?:\.git)?\/?$/i.exec(
|
|
3527
|
+
value
|
|
3528
|
+
);
|
|
3529
|
+
if (scp) return `https://github.com/${scp[1]}/${scp[2]}`;
|
|
3530
|
+
if (!/^(?:ssh|git\+ssh):\/\//i.test(value)) return void 0;
|
|
3531
|
+
try {
|
|
3532
|
+
const path3 = githubRepoPath(new URL(value));
|
|
3533
|
+
return path3 ? `https://github.com${path3}` : void 0;
|
|
3534
|
+
} catch {
|
|
3535
|
+
return void 0;
|
|
3536
|
+
}
|
|
3537
|
+
}
|
|
3538
|
+
function shortRevision(revision) {
|
|
3539
|
+
return stripBidiControls(revision).slice(0, 7);
|
|
3540
|
+
}
|
|
3541
|
+
function githubCommitUrl(ci) {
|
|
3542
|
+
if (!ci?.remote || !ci.revision) return void 0;
|
|
3543
|
+
const base = githubBaseUrl(ci.remote);
|
|
3544
|
+
if (!base) return void 0;
|
|
3545
|
+
return `${base}/commit/${encodeURIComponent(stripBidiControls(ci.revision))}`;
|
|
3546
|
+
}
|
|
3547
|
+
function revisionMarkup(ci) {
|
|
3548
|
+
if (!ci?.revision) return "";
|
|
3549
|
+
const short = escapeHtml(shortRevision(ci.revision));
|
|
3550
|
+
const commit = githubCommitUrl(ci);
|
|
3551
|
+
if (!commit) return short;
|
|
3552
|
+
return `<a href="${escapeHtml(commit)}" title="${escapeHtml(ci.revision)}" rel="noopener noreferrer">${short}</a>`;
|
|
3553
|
+
}
|
|
3554
|
+
function ciNameMarkup(ci) {
|
|
3555
|
+
const href = safeHttpUrl(ci?.url);
|
|
3556
|
+
const label = ci?.name || href;
|
|
3557
|
+
if (!label) return "";
|
|
3558
|
+
return href ? `<a href="${escapeHtml(href)}" rel="noopener noreferrer">${escapeHtml(label)}</a>` : escapeHtml(label);
|
|
3559
|
+
}
|
|
3560
|
+
function ciHeaderMarkup(ci) {
|
|
3561
|
+
if (!ci) return "";
|
|
3562
|
+
const name = ciNameMarkup(ci);
|
|
3563
|
+
const rows = [
|
|
3564
|
+
name ? `<span class="ci"><b>CI</b> ${name}</span>` : "",
|
|
3565
|
+
ci.revision ? `<span><b>Revision</b> ${revisionMarkup(ci)}</span>` : "",
|
|
3566
|
+
ci.branch ? `<span><b>Branch</b> <span>${escapeHtml(ci.branch)}</span></span>` : "",
|
|
3567
|
+
ci.tag ? `<span><b>Tag</b> <span>${escapeHtml(ci.tag)}</span></span>` : ""
|
|
3568
|
+
].filter(Boolean);
|
|
3569
|
+
return rows.join("");
|
|
3570
|
+
}
|
|
3571
|
+
function ciDetailRows(ci) {
|
|
3572
|
+
if (!ci) return "";
|
|
3573
|
+
const name = ciNameMarkup(ci);
|
|
3574
|
+
return [
|
|
3575
|
+
name ? `<dt>CI</dt><dd>${name}</dd>` : "",
|
|
3576
|
+
ci.revision ? `<dt>Revision</dt><dd>${revisionMarkup(ci)}</dd>` : "",
|
|
3577
|
+
ci.branch ? `<dt>Branch</dt><dd>${escapeHtml(ci.branch)}</dd>` : "",
|
|
3578
|
+
ci.tag ? `<dt>Tag</dt><dd>${escapeHtml(ci.tag)}</dd>` : ""
|
|
3579
|
+
].join("");
|
|
3580
|
+
}
|
|
3581
|
+
function prettyJson(text) {
|
|
3582
|
+
try {
|
|
3583
|
+
JSON.parse(text);
|
|
3584
|
+
} catch {
|
|
3585
|
+
return void 0;
|
|
3586
|
+
}
|
|
3587
|
+
const out = [];
|
|
3588
|
+
const stack = [];
|
|
3589
|
+
let inString = false;
|
|
3590
|
+
let escaped = false;
|
|
3591
|
+
const openItem = () => {
|
|
3592
|
+
const top = stack[stack.length - 1];
|
|
3593
|
+
if (top && !top.hasItems) {
|
|
3594
|
+
out.push("\n", " ".repeat(stack.length));
|
|
3595
|
+
top.hasItems = true;
|
|
3596
|
+
}
|
|
3597
|
+
};
|
|
3598
|
+
for (let index = 0; index < text.length; index += 1) {
|
|
3599
|
+
const character = text[index];
|
|
3600
|
+
if (inString) {
|
|
3601
|
+
out.push(character);
|
|
3602
|
+
if (escaped) escaped = false;
|
|
3603
|
+
else if (character === "\\") escaped = true;
|
|
3604
|
+
else if (character === '"') inString = false;
|
|
3605
|
+
continue;
|
|
3606
|
+
}
|
|
3607
|
+
if (character === '"') {
|
|
3608
|
+
openItem();
|
|
3609
|
+
out.push(character);
|
|
3610
|
+
inString = true;
|
|
3611
|
+
continue;
|
|
3612
|
+
}
|
|
3613
|
+
if (character === "{" || character === "[") {
|
|
3614
|
+
openItem();
|
|
3615
|
+
out.push(character);
|
|
3616
|
+
stack.push({ opener: character, hasItems: false });
|
|
3617
|
+
continue;
|
|
3618
|
+
}
|
|
3619
|
+
if (character === "}" || character === "]") {
|
|
3620
|
+
const frame = stack.pop();
|
|
3621
|
+
if (!frame) return void 0;
|
|
3622
|
+
if (frame.opener === "{" && character !== "}" || frame.opener === "[" && character !== "]") {
|
|
3623
|
+
return void 0;
|
|
3624
|
+
}
|
|
3625
|
+
if (frame.hasItems) out.push("\n", " ".repeat(stack.length));
|
|
3626
|
+
out.push(character);
|
|
3627
|
+
continue;
|
|
3628
|
+
}
|
|
3629
|
+
if (character === ",") {
|
|
3630
|
+
out.push(",", "\n", " ".repeat(stack.length));
|
|
3631
|
+
continue;
|
|
3632
|
+
}
|
|
3633
|
+
if (character === ":") {
|
|
3634
|
+
out.push(": ");
|
|
3635
|
+
continue;
|
|
3636
|
+
}
|
|
3637
|
+
if (character === " " || character === "\n" || character === "\r" || character === " ") {
|
|
3638
|
+
continue;
|
|
3639
|
+
}
|
|
3640
|
+
let end = index;
|
|
3641
|
+
while (end < text.length && !/[\s,\]}:]/.test(text[end])) {
|
|
3642
|
+
end += 1;
|
|
3643
|
+
}
|
|
3644
|
+
openItem();
|
|
3645
|
+
out.push(text.slice(index, end));
|
|
3646
|
+
index = end - 1;
|
|
3647
|
+
}
|
|
3648
|
+
return stack.length === 0 && !inString ? out.join("") : void 0;
|
|
3649
|
+
}
|
|
3650
|
+
function jsonBody(text) {
|
|
3651
|
+
return prettyJson(text) ?? text;
|
|
3652
|
+
}
|
|
3653
|
+
function uriListBody(text) {
|
|
3654
|
+
return text.split(/\r?\n/).map((line) => {
|
|
3655
|
+
const label = line.trim();
|
|
3656
|
+
const href = safeHttpUrl(label);
|
|
3657
|
+
return href ? `<a href="${escapeHtml(href)}" rel="noopener noreferrer">${escapeHtml(label)}</a>` : escapeHtml(line);
|
|
3658
|
+
}).join("\n");
|
|
3659
|
+
}
|
|
3660
|
+
function textAttachmentBody(attachment) {
|
|
3661
|
+
const text = attachment.text ?? "";
|
|
3662
|
+
const mediaType = normalizedMediaType(attachment.mediaType);
|
|
3663
|
+
if (mediaType.startsWith("application/json")) {
|
|
3664
|
+
const body = Buffer.byteLength(text, "utf8") > MAX_TEXT_ATTACHMENT_BYTES ? text : jsonBody(text);
|
|
3665
|
+
return `<pre>${escapeHtml(body)}</pre>`;
|
|
3666
|
+
}
|
|
3667
|
+
if (mediaType === "text/uri-list") {
|
|
3668
|
+
return `<pre>${uriListBody(text)}</pre>`;
|
|
3669
|
+
}
|
|
3670
|
+
if (mediaType === "text/x.cucumber.log+plain") {
|
|
3671
|
+
return `<div class="logTools"><button class="copyLog" type="button" data-copy-log aria-label="Copy log ${escapeHtml(attachment.fileName)}" hidden>Copy log</button></div><pre class="ansiLog">${renderAnsiLog(text)}</pre>`;
|
|
3672
|
+
}
|
|
3673
|
+
return `<pre>${escapeHtml(text)}</pre>`;
|
|
3674
|
+
}
|
|
2763
3675
|
function renderAttachment(attachment, context) {
|
|
2764
3676
|
const name = escapeHtml(attachment.fileName);
|
|
2765
3677
|
const media = escapeHtml(attachment.mediaType);
|
|
@@ -2774,7 +3686,7 @@ function renderAttachment(attachment, context) {
|
|
|
2774
3686
|
return `<figure class="attachment"><audio controls src="${escapeHtml(attachment.dataUri)}"></audio><figcaption>${name} (${media})</figcaption></figure>`;
|
|
2775
3687
|
}
|
|
2776
3688
|
if (attachment.kind === "text" && attachment.text !== void 0) {
|
|
2777
|
-
return `<details class="attachmentText"><summary>${name} (${media})</summary
|
|
3689
|
+
return `<details class="attachmentText"><summary>${name} (${media})</summary>${textAttachmentBody(attachment)}</details>`;
|
|
2778
3690
|
}
|
|
2779
3691
|
if (attachment.dataUri) {
|
|
2780
3692
|
return `<a class="fileLink" href="${escapeHtml(attachment.dataUri)}" download="${name}">${name} (${media}, ${attachment.bytes} bytes)</a>`;
|
|
@@ -2786,7 +3698,50 @@ function scenarioTags(model) {
|
|
|
2786
3698
|
(a, b) => a.localeCompare(b)
|
|
2787
3699
|
);
|
|
2788
3700
|
}
|
|
3701
|
+
function renderDiagnostic(step) {
|
|
3702
|
+
if (step.status === "undefined") {
|
|
3703
|
+
const suggestions = step.suggestions ?? [];
|
|
3704
|
+
const lead = suggestions.length ? `${UNDEFINED_LEAD} Implement with the snippet(s) below:` : UNDEFINED_LEAD;
|
|
3705
|
+
const snippets = suggestions.map((suggestion) => {
|
|
3706
|
+
const language = suggestion.language ? `<span class="snippetLang">${escapeHtml(suggestion.language)}</span>` : "";
|
|
3707
|
+
return `<div class="snippet">${language}<pre><code>${escapeHtml(suggestion.code)}</code></pre></div>`;
|
|
3708
|
+
}).join("");
|
|
3709
|
+
return `<div class="diagnostic" data-diagnostic="undefined"><p class="diagnosticLead">${lead}</p>${snippets}</div>`;
|
|
3710
|
+
}
|
|
3711
|
+
if (step.status === "ambiguous") {
|
|
3712
|
+
const definitions = step.definitions ?? [];
|
|
3713
|
+
const items = definitions.map(
|
|
3714
|
+
(definition) => `<li><code class="definitionPattern">${escapeHtml(definition.pattern)}</code>${definition.source ? `<span class="definitionSource">${escapeHtml(displayUri(definition.source))}</span>` : ""}</li>`
|
|
3715
|
+
).join("");
|
|
3716
|
+
const list = items ? `<ul class="definitions">${items}</ul>` : "";
|
|
3717
|
+
return `<div class="diagnostic" data-diagnostic="ambiguous"><p class="diagnosticLead">${AMBIGUOUS_LEAD}</p>${list}</div>`;
|
|
3718
|
+
}
|
|
3719
|
+
return "";
|
|
3720
|
+
}
|
|
3721
|
+
function renderStepText(step) {
|
|
3722
|
+
const parameters = step.parameters;
|
|
3723
|
+
if (!parameters?.length) return escapeHtml(step.text);
|
|
3724
|
+
let cursor = 0;
|
|
3725
|
+
for (const parameter of parameters) {
|
|
3726
|
+
const end = parameter.start + parameter.value.length;
|
|
3727
|
+
if (!Number.isInteger(parameter.start) || parameter.start < cursor || !parameter.value.length || end > step.text.length || step.text.slice(parameter.start, end) !== parameter.value) {
|
|
3728
|
+
return escapeHtml(step.text);
|
|
3729
|
+
}
|
|
3730
|
+
cursor = end;
|
|
3731
|
+
}
|
|
3732
|
+
cursor = 0;
|
|
3733
|
+
let html = "";
|
|
3734
|
+
for (const parameter of parameters) {
|
|
3735
|
+
const end = parameter.start + parameter.value.length;
|
|
3736
|
+
const matched = step.text.slice(parameter.start, end);
|
|
3737
|
+
html += escapeHtml(step.text.slice(cursor, parameter.start));
|
|
3738
|
+
html += `<span class="param" data-parameter-type="${escapeHtml(parameter.type)}">${escapeHtml(matched)}</span>`;
|
|
3739
|
+
cursor = end;
|
|
3740
|
+
}
|
|
3741
|
+
return html + escapeHtml(step.text.slice(cursor));
|
|
3742
|
+
}
|
|
2789
3743
|
function renderStep(step, scenarioName) {
|
|
3744
|
+
const diagnostic = renderDiagnostic(step);
|
|
2790
3745
|
const docString = step.docString ? `<pre class="docString">${escapeHtml(step.docString)}</pre>` : "";
|
|
2791
3746
|
const table = step.dataTable ? `<div class="tableWrap" tabindex="0" role="region" aria-label="Data table for: ${escapeHtml(step.text)}"><table class="dataTable"><tbody>${step.dataTable.map(
|
|
2792
3747
|
(row, index) => `<tr>${row.map(
|
|
@@ -2796,37 +3751,258 @@ function renderStep(step, scenarioName) {
|
|
|
2796
3751
|
const error = step.message ? `<pre class="error">${escapeHtml(step.message)}</pre>` : "";
|
|
2797
3752
|
const context = `${scenarioName}: ${step.keyword.trim()} ${step.text}`;
|
|
2798
3753
|
const attachments = step.attachments.map((attachment) => renderAttachment(attachment, context)).join("");
|
|
2799
|
-
return `<li class="step"${step.status === "failed" ? ' data-status="failed"' : ""}><span class="stepMarker ${statusClass(step.status)}"><span aria-hidden="true">${STEP_GLYPHS[step.status]}</span><span class="sr">${statusLabel(step.status)}</span></span><div><span class="kw">${escapeHtml(step.keyword)}</span>
|
|
3754
|
+
return `<li class="step"${step.status === "failed" ? ' data-status="failed"' : ""}><span class="stepMarker ${statusClass(step.status)}"><span aria-hidden="true">${STEP_GLYPHS[step.status]}</span><span class="sr">${statusLabel(step.status)}</span></span><div><span class="kw">${escapeHtml(step.keyword)}</span> <span class="stepText">${renderStepText(step)}</span>${diagnostic}${error}${docString}${table}${attachments}</div><span class="dur">${durationLabel(step.durationMs)}</span></li>`;
|
|
3755
|
+
}
|
|
3756
|
+
function hookLabel2(hook, bareName = false) {
|
|
3757
|
+
if (hook.name) return bareName ? hook.name : `${hook.type}: ${hook.name}`;
|
|
3758
|
+
return hook.type;
|
|
3759
|
+
}
|
|
3760
|
+
function renderHook(hook, scenarioName, bareName = false) {
|
|
3761
|
+
const error = hook.message ? `<pre class="error">${escapeHtml(hook.message)}</pre>` : "";
|
|
3762
|
+
const label = hookLabel2(hook, bareName);
|
|
3763
|
+
const attachments = hook.attachments.map((attachment) => renderAttachment(attachment, `${scenarioName}: ${label}`)).join("");
|
|
3764
|
+
return `<li class="hook" data-status="${hook.status}"><span class="stepMarker ${statusClass(hook.status)}"><span aria-hidden="true">${STEP_GLYPHS[hook.status]}</span><span class="sr">${statusLabel(hook.status)}</span></span><div><span class="hookLabel">${escapeHtml(label)}</span>${error}${attachments}</div><span class="dur">${durationLabel(hook.durationMs)}</span></li>`;
|
|
3765
|
+
}
|
|
3766
|
+
function renderRunHooks(model) {
|
|
3767
|
+
if (model.runHooks.length === 0) return "";
|
|
3768
|
+
return `<section class="runHooks" data-run-hooks aria-labelledby="run-hooks-heading"><h2 id="run-hooks-heading">Hooks</h2><ul class="hooks">${model.runHooks.map((hook) => renderHook(hook, "Run", true)).join("")}</ul></section>`;
|
|
3769
|
+
}
|
|
3770
|
+
function scenarioLabel(scenario) {
|
|
3771
|
+
const outline = scenario.outline;
|
|
3772
|
+
if (!outline) return scenario.name;
|
|
3773
|
+
const number = `#${outline.examplesIndex + 1}.${outline.exampleIndex + 1}`;
|
|
3774
|
+
const examples = outline.examplesName ? `${outline.examplesName} ` : "";
|
|
3775
|
+
return `${examples}${number} \xB7 ${scenario.name}`.trim();
|
|
3776
|
+
}
|
|
3777
|
+
function tagsMarkup(tags, extraClass = "") {
|
|
3778
|
+
const className = extraClass ? `tags ${extraClass}` : "tags";
|
|
3779
|
+
return tags.length ? `<span class="${className}">${tags.map((tag) => `<span class="tag">${escapeHtml(tag)}</span>`).join("")}</span>` : "";
|
|
3780
|
+
}
|
|
3781
|
+
function backgroundText(background) {
|
|
3782
|
+
return [background.name, background.description].join(" ");
|
|
3783
|
+
}
|
|
3784
|
+
function backgroundMarkup(backgrounds) {
|
|
3785
|
+
return backgrounds.filter((background) => background.name || background.description).map((background) => {
|
|
3786
|
+
const name = background.name ? ` ${escapeHtml(background.name)}` : "";
|
|
3787
|
+
const description = renderDescription(background.description);
|
|
3788
|
+
return `<section class="background" data-background><h3 class="backgroundTitle"><span class="kw">${escapeHtml(background.keyword)}:</span>${name}</h3>${description}</section>`;
|
|
3789
|
+
}).join("");
|
|
3790
|
+
}
|
|
3791
|
+
function ruleSearchText(rule) {
|
|
3792
|
+
return [
|
|
3793
|
+
rule.name,
|
|
3794
|
+
rule.description,
|
|
3795
|
+
...rule.tags,
|
|
3796
|
+
...rule.backgrounds.map(backgroundText)
|
|
3797
|
+
].join(" ");
|
|
2800
3798
|
}
|
|
2801
3799
|
function scenarioText(scenario) {
|
|
3800
|
+
const outline = scenario.outline;
|
|
3801
|
+
const example = outline ? `#${outline.examplesIndex + 1}.${outline.exampleIndex + 1}` : "";
|
|
2802
3802
|
return [
|
|
2803
3803
|
scenario.name,
|
|
2804
3804
|
scenario.featureName,
|
|
2805
3805
|
displayUri(scenario.uri),
|
|
2806
|
-
scenario.keyword,
|
|
2807
|
-
scenario.description,
|
|
3806
|
+
outline ? outline.keyword : scenario.keyword,
|
|
3807
|
+
...outline ? [outline.name, outline.examplesKeyword, outline.examplesName, example] : [scenario.description],
|
|
2808
3808
|
scenario.tags.join(" "),
|
|
2809
|
-
scenario.
|
|
3809
|
+
scenario.hooks.map(
|
|
3810
|
+
(hook) => `${hook.type} ${hook.name ?? ""} ${(hook.message ?? "").slice(0, SEARCH_MESSAGE_LIMIT)}`
|
|
3811
|
+
).join(" "),
|
|
3812
|
+
scenario.steps.map((step) => {
|
|
3813
|
+
const diagnostic = step.status === "undefined" || step.status === "ambiguous" ? [
|
|
3814
|
+
step.status === "undefined" ? UNDEFINED_LEAD : AMBIGUOUS_LEAD,
|
|
3815
|
+
...(step.suggestions ?? []).flatMap((suggestion) => [
|
|
3816
|
+
suggestion.language ?? "",
|
|
3817
|
+
suggestion.code.slice(0, SEARCH_MESSAGE_LIMIT)
|
|
3818
|
+
]),
|
|
3819
|
+
...(step.definitions ?? []).flatMap((definition) => [
|
|
3820
|
+
definition.pattern.slice(0, SEARCH_MESSAGE_LIMIT),
|
|
3821
|
+
displayUri(definition.source ?? "").slice(
|
|
3822
|
+
0,
|
|
3823
|
+
SEARCH_MESSAGE_LIMIT
|
|
3824
|
+
)
|
|
3825
|
+
])
|
|
3826
|
+
].join(" ") : "";
|
|
3827
|
+
return `${step.keyword} ${step.text} ${(step.message ?? "").slice(0, SEARCH_MESSAGE_LIMIT)} ${diagnostic}`;
|
|
3828
|
+
}).join(" ")
|
|
2810
3829
|
].join(" ");
|
|
2811
3830
|
}
|
|
2812
|
-
function renderScenario(scenario, featureIndex, scenarioIndex) {
|
|
3831
|
+
function renderScenario(scenario, featureIndex, scenarioIndex, grouped = false, inRule = false) {
|
|
3832
|
+
const outline = scenario.outline;
|
|
3833
|
+
const example = grouped && outline ? `#${outline.examplesIndex + 1}.${outline.exampleIndex + 1}` : "";
|
|
3834
|
+
const heading = grouped ? "h5" : inRule ? "h4" : "h3";
|
|
2813
3835
|
const image = scenario.attachments.find(
|
|
2814
3836
|
(attachment) => attachment.kind === "image" && attachment.dataUri
|
|
2815
3837
|
);
|
|
2816
|
-
const open = scenario.status
|
|
2817
|
-
const
|
|
2818
|
-
|
|
2819
|
-
|
|
3838
|
+
const open = scenario.executed && (scenario.status !== "passed" || !grouped && Boolean(image));
|
|
3839
|
+
const passedHooks = scenario.hooks.filter(
|
|
3840
|
+
(hook) => hook.status === "passed"
|
|
3841
|
+
);
|
|
3842
|
+
const inlineItems = [
|
|
3843
|
+
...scenario.steps.map((step) => ({
|
|
3844
|
+
order: step.order,
|
|
3845
|
+
html: renderStep(step, scenario.name)
|
|
3846
|
+
})),
|
|
3847
|
+
...scenario.hooks.filter((hook) => hook.status !== "passed").map((hook) => ({ order: hook.order, html: renderHook(hook, scenario.name) }))
|
|
3848
|
+
].sort((a, b) => a.order - b.order).map((item) => item.html).join("");
|
|
3849
|
+
const passedHooksGroup = passedHooks.length ? `<details class="hookGroup"><summary>${passedHooks.length} hook${passedHooks.length === 1 ? "" : "s"}</summary><ul class="hooks" aria-label="Passed hooks">${passedHooks.map((hook) => renderHook(hook, scenario.name)).join("")}</ul></details>` : "";
|
|
3850
|
+
const description = grouped ? "" : renderDescription(scenario.description);
|
|
3851
|
+
const screenReaderLabel = grouped && outline ? `<span class="sr">${escapeHtml(`${scenario.name}, Scenario Outline ${outline.name}${outline.examplesName ? `, Examples ${outline.examplesName}` : ""}, example ${example}`)}</span>` : "";
|
|
3852
|
+
const visibleName = grouped ? `<span class="exampleNo" aria-hidden="true">${escapeHtml(example)}</span>${screenReaderLabel}` : escapeHtml(scenario.name);
|
|
3853
|
+
const rowTags = grouped ? "" : tagsMarkup(scenario.ownTags);
|
|
3854
|
+
const extraAttachments = scenario.extraAttachments.length ? `<div role="group" aria-label="Attachments"><p class="detailLabel">Attachments</p>${scenario.extraAttachments.map((attachment) => renderAttachment(attachment, scenario.name)).join("")}</div>` : "";
|
|
2820
3855
|
const copyFailure = scenario.status === "failed" ? '<button class="copyFailure" type="button" data-copy-failure>Copy failure</button>' : "";
|
|
2821
|
-
|
|
3856
|
+
const exampleData = grouped ? ` data-example="${escapeHtml(example)}" data-examples-name="${escapeHtml(outline?.examplesName ?? "")}"` : "";
|
|
3857
|
+
const scenarioMeta = grouped && outline ? `<span>Scenario: ${escapeHtml(scenario.name)}</span>` : "";
|
|
3858
|
+
const statusCell = scenario.executed ? `<span class="statusCell"><span class="statusText ${statusClass(scenario.status)}">${statusLabel(scenario.status)}</span></span>` : '<span class="statusCell"><span class="sr">Not executed</span></span>';
|
|
3859
|
+
const statusData = scenario.executed ? ` data-status="${scenario.status}"` : "";
|
|
3860
|
+
return `<details class="scenario" id="scenario-${featureIndex + 1}-${scenarioIndex + 1}" data-scenario${statusData} data-uri="${escapeHtml(displayUri(scenario.uri))}" data-scenario-name="${escapeHtml(scenario.name)}"${exampleData} data-tags="${escapeHtml(scenario.tags.join(" "))}" data-search="${escapeHtml(scenarioText(scenario))}" ${open ? "open" : ""}><summary class="scenarioButton">${statusCell}<span class="thumbCell">${image ? `<img class="thumb" src="${escapeHtml(image.dataUri ?? "")}" alt="" loading="lazy">` : ""}</span><span class="scenarioMain"><${heading} class="scenarioName">${visibleName}</${heading}><span class="scenarioSub">${scenario.steps.length} step${scenario.steps.length === 1 ? "" : "s"}${scenario.hooks.length ? ` \xB7 ${scenario.hooks.length} hook${scenario.hooks.length === 1 ? "" : "s"}` : ""}${rowTags ? ` ${rowTags}` : ""}</span></span><span class="rowRight">${durationLabel(scenario.durationMs)}${scenario.attachments.length ? `<br>${scenario.attachments.length} attachment${scenario.attachments.length === 1 ? "" : "s"}` : ""}</span><span class="chev" aria-hidden="true"></span></summary><div class="detailInline">${description}<div class="stepsHead"><p class="detailLabel">Steps</p>${copyFailure}</div><ol class="steps" aria-label="Steps and hooks">${inlineItems}</ol>${passedHooksGroup}${extraAttachments}<div class="detailMeta">${scenarioMeta}<span>Feature: ${escapeHtml(scenario.featureName)}</span><span>Attempt: ${scenario.attempt + 1}</span>${scenario.startedAt ? `<span>Started: ${dateLabel(scenario.startedAt)}</span>` : ""}${scenario.ruleName ? `<span>Rule: ${escapeHtml(scenario.ruleName)}</span>` : ""}</div></div></details>`;
|
|
3861
|
+
}
|
|
3862
|
+
function renderExamples(outline, rows, featureIndex, idIndex) {
|
|
3863
|
+
const description = renderDescription(outline.examplesDescription);
|
|
3864
|
+
const title = outline.examplesName ? `<span class="kw">${escapeHtml(outline.examplesKeyword)}:</span> ${escapeHtml(outline.examplesName)}` : `<span class="kw">${escapeHtml(outline.examplesKeyword)}:</span>`;
|
|
3865
|
+
return `<section class="examples" data-examples data-search="${escapeHtml(outline.examplesDescription)}">${tagsMarkup(outline.examplesTags)}<h4 class="examplesTitle">${title}</h4>${description}<div class="exampleRows">${rows.map(
|
|
3866
|
+
(scenario) => renderScenario(
|
|
3867
|
+
scenario,
|
|
3868
|
+
featureIndex,
|
|
3869
|
+
idIndex.get(scenario.id) ?? 0,
|
|
3870
|
+
true
|
|
3871
|
+
)
|
|
3872
|
+
).join("")}</div></section>`;
|
|
3873
|
+
}
|
|
3874
|
+
function renderOutline(outline, rows, featureIndex, idIndex) {
|
|
3875
|
+
const blocks = /* @__PURE__ */ new Map();
|
|
3876
|
+
for (const row of rows) {
|
|
3877
|
+
if (!row.outline) continue;
|
|
3878
|
+
const block = blocks.get(row.outline.examplesId) ?? {
|
|
3879
|
+
outline: row.outline,
|
|
3880
|
+
rows: []
|
|
3881
|
+
};
|
|
3882
|
+
block.rows.push(row);
|
|
3883
|
+
blocks.set(row.outline.examplesId, block);
|
|
3884
|
+
}
|
|
3885
|
+
const exampleBlocks = [...blocks.values()].sort((a, b) => a.outline.examplesIndex - b.outline.examplesIndex).map(
|
|
3886
|
+
(block) => renderExamples(block.outline, block.rows, featureIndex, idIndex)
|
|
3887
|
+
).join("");
|
|
3888
|
+
const description = renderDescription(outline.description);
|
|
3889
|
+
return `<section class="outline" data-outline data-search="${escapeHtml(outline.description)}">${tagsMarkup(outline.tags)}<h3 class="outlineTitle"><span class="kw">${escapeHtml(outline.keyword)}:</span> ${escapeHtml(outline.name)}</h3>${description}${exampleBlocks}</section>`;
|
|
3890
|
+
}
|
|
3891
|
+
function renderFeatureItem(item, featureIndex, idIndex, inRule) {
|
|
3892
|
+
if (item.kind === "outline" && item.outline && item.rows) {
|
|
3893
|
+
return renderOutline(item.outline, item.rows, featureIndex, idIndex);
|
|
3894
|
+
}
|
|
3895
|
+
if (item.scenario) {
|
|
3896
|
+
return renderScenario(
|
|
3897
|
+
item.scenario,
|
|
3898
|
+
featureIndex,
|
|
3899
|
+
idIndex.get(item.scenario.id) ?? 0,
|
|
3900
|
+
false,
|
|
3901
|
+
inRule
|
|
3902
|
+
);
|
|
3903
|
+
}
|
|
3904
|
+
return "";
|
|
3905
|
+
}
|
|
3906
|
+
function renderRuleBlock(block, featureIndex, idIndex) {
|
|
3907
|
+
const rule = block.rule;
|
|
3908
|
+
const name = rule.name ? ` ${escapeHtml(rule.name)}` : "";
|
|
3909
|
+
const description = renderDescription(rule.description);
|
|
3910
|
+
return `<section class="rule" data-rule data-search="${escapeHtml(ruleSearchText(rule))}"><h3 class="ruleTitle"><span class="kw">${escapeHtml(rule.keyword)}:</span>${name}</h3>${tagsMarkup(rule.tags, "ruleTags")}${description}${backgroundMarkup(rule.backgrounds)}<div class="ruleRows">${block.items.map((item) => renderFeatureItem(item, featureIndex, idIndex, true)).join("")}</div></section>`;
|
|
2822
3911
|
}
|
|
2823
3912
|
function renderFeature({ feature, scenarios }, featureIndex) {
|
|
2824
|
-
const
|
|
2825
|
-
|
|
3913
|
+
const executed = executedOnly(scenarios);
|
|
3914
|
+
const open = executed.length === 0 || executed.some(
|
|
3915
|
+
(scenario) => scenario.status !== "passed" || scenario.attachments.some((attachment) => attachment.kind === "image")
|
|
3916
|
+
);
|
|
3917
|
+
const description = renderDescription(feature.description);
|
|
3918
|
+
const idIndex = new Map(scenarios.map((scenario, index) => [scenario.id, index]));
|
|
3919
|
+
const inputIndex = new Map(
|
|
3920
|
+
feature.scenarios.map((scenario, index) => [scenario.id, index])
|
|
3921
|
+
);
|
|
3922
|
+
const groups = /* @__PURE__ */ new Map();
|
|
3923
|
+
const items = [];
|
|
3924
|
+
for (const scenario of feature.scenarios) {
|
|
3925
|
+
if (scenario.outline) {
|
|
3926
|
+
const group = groups.get(scenario.outline.id) ?? {
|
|
3927
|
+
outline: scenario.outline,
|
|
3928
|
+
rows: [],
|
|
3929
|
+
order: inputIndex.get(scenario.id) ?? 0,
|
|
3930
|
+
...scenario.rule ? { ruleId: scenario.rule.id } : {}
|
|
3931
|
+
};
|
|
3932
|
+
group.rows.push(scenario);
|
|
3933
|
+
groups.set(scenario.outline.id, group);
|
|
3934
|
+
} else {
|
|
3935
|
+
items.push({
|
|
3936
|
+
kind: "scenario",
|
|
3937
|
+
status: scenario.status,
|
|
3938
|
+
order: inputIndex.get(scenario.id) ?? 0,
|
|
3939
|
+
...scenario.rule ? { ruleId: scenario.rule.id } : {},
|
|
3940
|
+
scenario
|
|
3941
|
+
});
|
|
3942
|
+
}
|
|
3943
|
+
}
|
|
3944
|
+
for (const group of groups.values()) {
|
|
3945
|
+
group.rows.sort((a, b) => {
|
|
3946
|
+
const outlineA = a.outline;
|
|
3947
|
+
const outlineB = b.outline;
|
|
3948
|
+
if (!outlineA || !outlineB) return 0;
|
|
3949
|
+
return outlineA.examplesIndex - outlineB.examplesIndex || outlineA.exampleIndex - outlineB.exampleIndex;
|
|
3950
|
+
});
|
|
3951
|
+
items.push({
|
|
3952
|
+
kind: "outline",
|
|
3953
|
+
status: worstExecutedStatus(group.rows),
|
|
3954
|
+
order: group.order,
|
|
3955
|
+
...group.ruleId ? { ruleId: group.ruleId } : {},
|
|
3956
|
+
outline: group.outline,
|
|
3957
|
+
rows: group.rows
|
|
3958
|
+
});
|
|
3959
|
+
}
|
|
3960
|
+
items.sort((a, b) => {
|
|
3961
|
+
const status = compareStatus(a.status, b.status);
|
|
3962
|
+
return status !== 0 ? status : a.order - b.order;
|
|
3963
|
+
});
|
|
3964
|
+
const featureItems = [];
|
|
3965
|
+
const ruleBlocks = /* @__PURE__ */ new Map();
|
|
3966
|
+
for (const item of items) {
|
|
3967
|
+
const rule = item.scenario?.rule ?? item.rows?.[0]?.rule;
|
|
3968
|
+
if (!item.ruleId || !rule) {
|
|
3969
|
+
featureItems.push(item);
|
|
3970
|
+
continue;
|
|
3971
|
+
}
|
|
3972
|
+
const block = ruleBlocks.get(item.ruleId) ?? {
|
|
3973
|
+
rule,
|
|
3974
|
+
items: [],
|
|
3975
|
+
order: item.order
|
|
3976
|
+
};
|
|
3977
|
+
block.items.push(item);
|
|
3978
|
+
block.order = Math.min(block.order, item.order);
|
|
3979
|
+
ruleBlocks.set(item.ruleId, block);
|
|
3980
|
+
}
|
|
3981
|
+
const topItems = [
|
|
3982
|
+
...featureItems,
|
|
3983
|
+
...[...ruleBlocks.values()].map(
|
|
3984
|
+
(block) => ({
|
|
3985
|
+
kind: "rule",
|
|
3986
|
+
status: worstExecutedStatus(
|
|
3987
|
+
block.items.flatMap(
|
|
3988
|
+
(item) => item.scenario ? [item.scenario] : item.rows ?? []
|
|
3989
|
+
)
|
|
3990
|
+
),
|
|
3991
|
+
order: block.order,
|
|
3992
|
+
rule: block.rule,
|
|
3993
|
+
items: block.items
|
|
3994
|
+
})
|
|
3995
|
+
)
|
|
3996
|
+
];
|
|
3997
|
+
topItems.sort((a, b) => {
|
|
3998
|
+
const status = compareStatus(a.status, b.status);
|
|
3999
|
+
return status !== 0 ? status : a.order - b.order;
|
|
4000
|
+
});
|
|
4001
|
+
const backgroundSearch = escapeHtml(
|
|
4002
|
+
feature.backgrounds.map(backgroundText).join(" ")
|
|
2826
4003
|
);
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
(scenario, scenarioIndex) => renderScenario(scenario, featureIndex, scenarioIndex)
|
|
4004
|
+
return `<details class="feature ${feature.status === "failed" ? "has-fail" : "has-pass"}" id="feature-${featureIndex + 1}" data-feature data-background-search="${backgroundSearch}" ${open ? "open" : ""}><summary><span class="statusCell"><span class="statusText ${statusClass(feature.status)}">${statusLabel(feature.status)}</span></span><h2>${escapeHtml(feature.name)}</h2><span class="chev" aria-hidden="true"></span>${featureShape(feature, scenarios)}</summary>${description}${backgroundMarkup(feature.backgrounds)}<div class="rows">${topItems.map(
|
|
4005
|
+
(item) => item.kind === "rule" ? renderRuleBlock(item, featureIndex, idIndex) : renderFeatureItem(item, featureIndex, idIndex, false)
|
|
2830
4006
|
).join("")}</div></details>`;
|
|
2831
4007
|
}
|
|
2832
4008
|
function matrixStatuses(model) {
|
|
@@ -2838,12 +4014,13 @@ function renderFeatureMatrix(model) {
|
|
|
2838
4014
|
const statuses = matrixStatuses(model);
|
|
2839
4015
|
const head = `<tr><th>Feature</th><th>Total</th>${statuses.map((status) => `<th>${statusLabel(status)}</th>`).join("")}<th>Duration</th></tr>`;
|
|
2840
4016
|
const rows = model.features.map((feature) => {
|
|
2841
|
-
const
|
|
4017
|
+
const executed = executedOnly(feature.scenarios);
|
|
4018
|
+
const counts = countStatuses(executed);
|
|
2842
4019
|
const cells = statuses.map((status) => {
|
|
2843
4020
|
const count2 = counts[status] ?? 0;
|
|
2844
4021
|
return `<td class="num${count2 === 0 ? " zero" : ""}">${count2}</td>`;
|
|
2845
4022
|
}).join("");
|
|
2846
|
-
return `<tr><th scope="row"><span class="matrixName">${escapeHtml(feature.name)}</span><span class="matrixUri">${escapeHtml(displayUri(feature.uri))}</span></th><td class="num">${
|
|
4023
|
+
return `<tr><th scope="row"><span class="matrixName">${escapeHtml(feature.name)}</span><span class="matrixUri">${escapeHtml(displayUri(feature.uri))}</span></th><td class="num">${executed.length}</td>${cells}<td class="num">${durationLabel(feature.durationMs)}</td></tr>`;
|
|
2847
4024
|
}).join("");
|
|
2848
4025
|
return `<table class="featureTable"><thead>${head}</thead><tbody>${rows}</tbody></table>`;
|
|
2849
4026
|
}
|
|
@@ -2857,16 +4034,18 @@ function renderReportView(model, options) {
|
|
|
2857
4034
|
const passed = model.counts.scenarios.passed;
|
|
2858
4035
|
const percent = total === 0 ? 0 : Math.round(passed / total * 1e3) / 10;
|
|
2859
4036
|
const meta = metadataLine(options.metadata);
|
|
4037
|
+
const ci = ciHeaderMarkup(model.environment?.ci);
|
|
2860
4038
|
const date = dateLabel(model.startedAt);
|
|
2861
4039
|
const ordered = orderFeatures(model.features);
|
|
2862
4040
|
const features = ordered.map((feature, index) => renderFeature(feature, index)).join("");
|
|
2863
4041
|
const triage = renderTriage(ordered);
|
|
2864
4042
|
const sources = renderSourceStrip(model);
|
|
4043
|
+
const runHooks = renderRunHooks(model);
|
|
2865
4044
|
const tags = scenarioTags(model);
|
|
2866
4045
|
const tagFilter = tags.length ? `<label class="tagFilter"><span>Tag</span><select data-tag-filter><option value="">All tags</option>${tags.map((tag) => `<option value="${escapeHtml(tag)}">${escapeHtml(tag)}</option>`).join("")}</select></label>` : "";
|
|
2867
|
-
return `<div class="tabPanel" id="report-view" role="tabpanel" aria-labelledby="view-report" tabindex="0"><main class="shell"><header class="runHead"><div><p class="path">${escapeHtml(model.source)} / ${escapeHtml(options.title)}</p><h1>${escapeHtml(options.title)}</h1><p class="meta">${date ? `<span>${date}</span>` : ""}<span>${model.counts.features} feature${model.counts.features === 1 ? "" : "s"}</span><span>${model.counts.scenarios.total} scenarios</span><span>${durationLabel(model.durationMs)}</span><span>${escapeHtml(model.source)}</span>${meta}</p></div><div class="health"><div class="healthTop"><strong>${percent}%</strong><span>${passed}
|
|
4046
|
+
return `<div class="tabPanel" id="report-view" role="tabpanel" aria-labelledby="view-report" tabindex="0"><main class="shell"><header class="runHead"><div><p class="path">${escapeHtml(model.source)} / ${escapeHtml(options.title)}</p><h1>${escapeHtml(options.title)}</h1><p class="meta">${date ? `<span>${date}</span>` : ""}<span>${model.counts.features} feature${model.counts.features === 1 ? "" : "s"}</span><span>${model.counts.scenarios.total} executed scenario${model.counts.scenarios.total === 1 ? "" : "s"}</span><span>${durationLabel(model.durationMs)}</span><span>${escapeHtml(model.source)}</span>${ci}${meta}</p></div><div class="health"><div class="healthTop"><strong>${percent}%</strong><span aria-hidden="true">${passed} / ${total}</span><span class="sr">${passed} / ${total} passed</span></div>${statusBar(model)}${countPills(model)}</div></header><div class="toolbar"><label class="search"><span aria-hidden="true">\u2315</span><input data-search type="search" placeholder="Search scenario, feature or tag" aria-label="Search scenarios"></label>${tagFilter}<div class="filters">${displayStatuses(model).map(
|
|
2868
4047
|
(status) => `<button class="filter" type="button" data-status="${status}" aria-pressed="true">${statusLabel(status)} <b>${model.counts.scenarios[status]}</b></button>`
|
|
2869
|
-
).join("")}</div><div class="expand"><button type="button" data-expand="all">Expand all</button><button type="button" data-expand="none">Collapse all</button></div></div><p class="live sr" id="tolkira-live" role="status" aria-live="polite" data-total="${total}"></p><p class="
|
|
4048
|
+
).join("")}</div><div class="expand"><button type="button" data-expand="all">Expand all</button><button type="button" data-expand="none">Collapse all</button></div></div><p class="live sr" id="tolkira-live" role="status" aria-live="polite" data-total="${total}"></p><p class="searchNote" id="tolkira-search-note" hidden></p>${triage}${sources}<div id="feature-list">${features || `<div class="empty">No scenarios in this report.</div>`}</div>${runHooks}<div class="empty" id="empty-results" hidden>No scenarios match the current search or filters.</div><p class="foot">Generated by Tolkira. Single file. No network requests. Screenshots are embedded.</p></main></div>`;
|
|
2870
4049
|
}
|
|
2871
4050
|
function renderAnalysisView(model, options, summary) {
|
|
2872
4051
|
const counts = model.counts.scenarios;
|
|
@@ -2884,316 +4063,14 @@ function renderAnalysisView(model, options, summary) {
|
|
|
2884
4063
|
model.environment?.runtime ? `<dt>Runtime</dt><dd>${escapeHtml(model.environment.runtime)}</dd>` : "",
|
|
2885
4064
|
model.environment?.os ? `<dt>OS</dt><dd>${escapeHtml(model.environment.os)}</dd>` : "",
|
|
2886
4065
|
model.environment?.cpu ? `<dt>CPU</dt><dd>${escapeHtml(model.environment.cpu)}</dd>` : "",
|
|
2887
|
-
model.environment?.protocol ? `<dt>Protocol</dt><dd>${escapeHtml(model.environment.protocol)}</dd>` : ""
|
|
4066
|
+
model.environment?.protocol ? `<dt>Protocol</dt><dd>${escapeHtml(model.environment.protocol)}</dd>` : "",
|
|
4067
|
+
ciDetailRows(model.environment?.ci)
|
|
2888
4068
|
].join("");
|
|
2889
|
-
const runRows = `<dt>Duration</dt><dd>${durationLabel(model.durationMs)}</dd><dt>Features</dt><dd>${model.counts.features}</dd><dt>Scenarios</dt><dd>${counts.total}</dd><dt>Steps</dt><dd>${model.counts.steps.total}</dd><dt>Attachments</dt><dd>${model.counts.attachments}</dd><dt>Attachment size</dt><dd>${model.counts.attachmentBytes} bytes</dd><dt>Source</dt><dd>${escapeHtml(model.source)}</dd>`;
|
|
2890
|
-
return `<div class="tabPanel" id="analysis-view" role="tabpanel" aria-labelledby="view-analysis" tabindex="0" hidden><main class="shell analysis"><header class="runHead"><div><p class="path">${escapeHtml(model.source)} / details</p><h1>Run details</h1><p class="meta">${dateLabel(model.startedAt) ? `<span>${dateLabel(model.startedAt)}</span>` : ""}<span>${escapeHtml(model.source)}</span></p></div><div class="health"><div class="healthTop"><strong>${counts.total === 0 ? 0 : Math.round(counts.passed / counts.total * 1e3) / 10}%</strong><span>${counts.passed}
|
|
4069
|
+
const runRows = `<dt>Duration</dt><dd>${durationLabel(model.durationMs)}</dd><dt>Features</dt><dd>${model.counts.features}</dd><dt>Scenarios</dt><dd>${counts.total}</dd><dt>Steps (excl. hooks)</dt><dd>${model.counts.steps.total}</dd><dt>Hooks</dt><dd>${model.counts.hooks.total}</dd><dt>Attachments</dt><dd>${model.counts.attachments}</dd><dt>Attachment size</dt><dd>${model.counts.attachmentBytes} bytes</dd><dt>Source</dt><dd>${escapeHtml(model.source)}</dd>`;
|
|
4070
|
+
return `<div class="tabPanel" id="analysis-view" role="tabpanel" aria-labelledby="view-analysis" tabindex="0" hidden><main class="shell analysis"><header class="runHead"><div><p class="path">${escapeHtml(model.source)} / details</p><h1>Run details</h1><p class="meta">${dateLabel(model.startedAt) ? `<span>${dateLabel(model.startedAt)}</span>` : ""}<span>${escapeHtml(model.source)}</span></p></div><div class="health"><div class="healthTop"><strong>${counts.total === 0 ? 0 : Math.round(counts.passed / counts.total * 1e3) / 10}%</strong><span>${counts.passed} / ${counts.total} passed</span></div>${statusBar(model)}${countPills(model)}</div></header><div class="analysisGrid"><section class="panel"><h2>Features</h2><p>Where the run spent its scenarios and steps.</p><p class="matrixHint">Executed scenarios only. Scroll for all status columns.</p><div class="tableWrap" tabindex="0" role="region" aria-label="Feature status matrix">${renderFeatureMatrix(model)}</div></section><section class="panel"><h2>Status distribution</h2><p>Executed scenarios only.</p><div class="legend">${displayStatuses(model).map(
|
|
2891
4071
|
(status) => `<div class="legendRow ${statusClass(status)}"><span class="marker ${statusClass(status)}"></span><span>${statusLabel(status)}</span><b>${counts[status]}</b></div>`
|
|
2892
|
-
).join("")}</div><h2 class="subhead">Run</h2><dl class="metaList">${runRows}</dl>${environmentRows ? `<h2 class="subhead">Cucumber environment</h2><dl class="metaList">${environmentRows}</dl>` : ""}${customRows ? `<h2 class="subhead">Custom metadata</h2><dl class="metaList">${customRows}</dl>` : ""}</section></div>${model.runAttachments.length ? `<section class="panel" style="margin-top:16px"><h2>Run attachments</h2>${model.runAttachments.map((attachment) => renderAttachment(attachment, "Run attachments")).join("")}</section>` : ""}<section class="panel" style="margin-top:16px"><h2>Agent summary</h2><p>The same run as stable JSON for CI tools and agents.</p><pre class="json" tabindex="0" aria-label="Agent summary JSON">${escapeHtml(JSON.stringify(preview))}</pre></section><p class="foot">Full summary: <code>tolkira ... --json</code></p></main></div>`;
|
|
2893
|
-
}
|
|
2894
|
-
var SCRIPT = `<script>
|
|
2895
|
-
(function () {
|
|
2896
|
-
var views = Array.prototype.slice.call(document.querySelectorAll('[data-view]'));
|
|
2897
|
-
var report = document.getElementById('report-view');
|
|
2898
|
-
var analysis = document.getElementById('analysis-view');
|
|
2899
|
-
function showView(name) {
|
|
2900
|
-
if (!report || !analysis) return;
|
|
2901
|
-
report.hidden = name !== 'report';
|
|
2902
|
-
analysis.hidden = name !== 'analysis';
|
|
2903
|
-
views.forEach(function (button) {
|
|
2904
|
-
var active = button.getAttribute('data-view') === name;
|
|
2905
|
-
button.setAttribute('aria-selected', active ? 'true' : 'false');
|
|
2906
|
-
});
|
|
2907
|
-
window.scrollTo(0, 0);
|
|
2908
|
-
}
|
|
2909
|
-
views.forEach(function (button) {
|
|
2910
|
-
button.addEventListener('click', function () { showView(button.getAttribute('data-view')); });
|
|
2911
|
-
});
|
|
2912
|
-
var tablist = document.querySelector('[role="tablist"]');
|
|
2913
|
-
if (tablist) tablist.addEventListener('keydown', function (event) {
|
|
2914
|
-
if (!['ArrowLeft', 'ArrowRight', 'Home', 'End'].includes(event.key)) return;
|
|
2915
|
-
event.preventDefault();
|
|
2916
|
-
var index = views.indexOf(document.activeElement);
|
|
2917
|
-
if (index < 0) return;
|
|
2918
|
-
var next = event.key === 'Home' ? 0 : event.key === 'End' ? views.length - 1 : (index + (event.key === 'ArrowRight' ? 1 : -1) + views.length) % views.length;
|
|
2919
|
-
views[next].focus();
|
|
2920
|
-
showView(views[next].getAttribute('data-view'));
|
|
2921
|
-
});
|
|
2922
|
-
var state = { query: '', hidden: new Set(), tag: '' };
|
|
2923
|
-
var searchOpened = [];
|
|
2924
|
-
var scenarios = Array.prototype.slice.call(document.querySelectorAll('[data-scenario]'));
|
|
2925
|
-
var features = Array.prototype.slice.call(document.querySelectorAll('[data-feature]'));
|
|
2926
|
-
var live = document.getElementById('tolkira-live');
|
|
2927
|
-
var searchNote = document.getElementById('tolkira-search-note');
|
|
2928
|
-
var triage = document.querySelector('[data-triage]');
|
|
2929
|
-
var sources = document.querySelector('[data-sources]');
|
|
2930
|
-
function apply() {
|
|
2931
|
-
var query = state.query.toLowerCase();
|
|
2932
|
-
var tag = state.tag;
|
|
2933
|
-
var visible = 0;
|
|
2934
|
-
scenarios.forEach(function (scenario) {
|
|
2935
|
-
var status = scenario.getAttribute('data-status');
|
|
2936
|
-
var text = (scenario.getAttribute('data-search') || '').toLowerCase();
|
|
2937
|
-
var tags = ' ' + (scenario.getAttribute('data-tags') || '') + ' ';
|
|
2938
|
-
var tagMatch = !tag || tags.indexOf(' ' + tag + ' ') !== -1;
|
|
2939
|
-
var match = !state.hidden.has(status) && tagMatch && (!query || text.indexOf(query) !== -1);
|
|
2940
|
-
scenario.hidden = !match;
|
|
2941
|
-
if (match) visible += 1;
|
|
2942
|
-
});
|
|
2943
|
-
features.forEach(function (feature) {
|
|
2944
|
-
var children = feature.querySelectorAll('[data-scenario]');
|
|
2945
|
-
var any = Array.prototype.some.call(children, function (child) { return !child.hidden; });
|
|
2946
|
-
feature.hidden = !any;
|
|
2947
|
-
if (any && (query || state.hidden.size || tag)) feature.open = true;
|
|
2948
|
-
});
|
|
2949
|
-
searchOpened.forEach(function (scenario) { scenario.open = false; });
|
|
2950
|
-
searchOpened = [];
|
|
2951
|
-
if (query) {
|
|
2952
|
-
var opened = 0;
|
|
2953
|
-
scenarios.forEach(function (scenario) {
|
|
2954
|
-
if (!scenario.hidden && opened < 20) {
|
|
2955
|
-
if (!scenario.open) searchOpened.push(scenario);
|
|
2956
|
-
scenario.open = true;
|
|
2957
|
-
opened += 1;
|
|
2958
|
-
}
|
|
2959
|
-
});
|
|
2960
|
-
}
|
|
2961
|
-
if (live) live.textContent = visible + ' of ' + scenarios.length + ' scenarios visible';
|
|
2962
|
-
if (searchNote) {
|
|
2963
|
-
if (query && visible > 20) {
|
|
2964
|
-
searchNote.textContent = '20 of ' + visible + ' matches expanded. Use Expand all to open the rest.';
|
|
2965
|
-
searchNote.hidden = false;
|
|
2966
|
-
} else {
|
|
2967
|
-
searchNote.hidden = true;
|
|
2968
|
-
searchNote.textContent = '';
|
|
2969
|
-
}
|
|
2970
|
-
}
|
|
2971
|
-
var empty = document.getElementById('empty-results');
|
|
2972
|
-
if (empty) empty.hidden = visible !== 0;
|
|
2973
|
-
if (triage) triage.hidden = Boolean(query || tag || state.hidden.size);
|
|
2974
|
-
if (sources) sources.hidden = Boolean(query || tag || state.hidden.size);
|
|
2975
|
-
highlightSearch();
|
|
2976
|
-
}
|
|
2977
|
-
function clearHighlights() {
|
|
2978
|
-
if (typeof CSS === 'undefined' || !CSS.highlights) return;
|
|
2979
|
-
CSS.highlights.delete('tolkira-search');
|
|
2980
|
-
}
|
|
2981
|
-
function escapeRegex(value) {
|
|
2982
|
-
var out = '';
|
|
2983
|
-
for (var i = 0; i < value.length; i++) {
|
|
2984
|
-
var code = value.charCodeAt(i);
|
|
2985
|
-
var ch = value.charAt(i);
|
|
2986
|
-
var special = code === 92 || code === 94 || code === 36 || code === 46 || code === 42 || code === 43 || code === 63 || code === 40 || code === 41 || code === 91 || code === 93 || code === 123 || code === 125 || code === 124;
|
|
2987
|
-
out += special ? String.fromCharCode(92) + ch : ch;
|
|
2988
|
-
}
|
|
2989
|
-
return out;
|
|
2990
|
-
}
|
|
2991
|
-
function highlightSearch() {
|
|
2992
|
-
if (typeof CSS === 'undefined' || !CSS.highlights || typeof Highlight === 'undefined') return;
|
|
2993
|
-
var needle = state.query.trim();
|
|
2994
|
-
if (needle.length < 2) { clearHighlights(); return; }
|
|
2995
|
-
try {
|
|
2996
|
-
var pattern = new RegExp(escapeRegex(needle), 'gi');
|
|
2997
|
-
var ranges = [];
|
|
2998
|
-
scenarios.forEach(function (scenario) {
|
|
2999
|
-
if (scenario.hidden || !scenario.open || ranges.length >= 200) return;
|
|
3000
|
-
var walker = document.createTreeWalker(scenario, NodeFilter.SHOW_TEXT, null);
|
|
3001
|
-
var node;
|
|
3002
|
-
while (ranges.length < 200 && (node = walker.nextNode())) {
|
|
3003
|
-
var value = node.nodeValue;
|
|
3004
|
-
if (!value) continue;
|
|
3005
|
-
var parent = node.parentElement;
|
|
3006
|
-
if (parent && (parent.tagName === 'SCRIPT' || parent.tagName === 'STYLE')) continue;
|
|
3007
|
-
pattern.lastIndex = 0;
|
|
3008
|
-
var match;
|
|
3009
|
-
while (ranges.length < 200 && (match = pattern.exec(value)) !== null) {
|
|
3010
|
-
var range = document.createRange();
|
|
3011
|
-
range.setStart(node, match.index);
|
|
3012
|
-
range.setEnd(node, match.index + match[0].length);
|
|
3013
|
-
ranges.push(range);
|
|
3014
|
-
if (match[0].length === 0) pattern.lastIndex += 1;
|
|
3015
|
-
}
|
|
3016
|
-
}
|
|
3017
|
-
});
|
|
3018
|
-
clearHighlights();
|
|
3019
|
-
if (ranges.length) CSS.highlights.set('tolkira-search', new Highlight(...ranges));
|
|
3020
|
-
} catch (error) {
|
|
3021
|
-
clearHighlights();
|
|
3022
|
-
}
|
|
3023
|
-
}
|
|
3024
|
-
var search = document.querySelector('[data-search]');
|
|
3025
|
-
if (search) search.addEventListener('input', function () {
|
|
3026
|
-
state.query = search.value;
|
|
3027
|
-
apply();
|
|
3028
|
-
});
|
|
3029
|
-
var tagFilter = document.querySelector('[data-tag-filter]');
|
|
3030
|
-
if (tagFilter) tagFilter.addEventListener('change', function () {
|
|
3031
|
-
state.tag = tagFilter.value;
|
|
3032
|
-
apply();
|
|
3033
|
-
});
|
|
3034
|
-
Array.prototype.slice.call(document.querySelectorAll('button.filter[data-status]')).forEach(function (button) {
|
|
3035
|
-
button.addEventListener('click', function () {
|
|
3036
|
-
var status = button.getAttribute('data-status');
|
|
3037
|
-
var active = button.getAttribute('aria-pressed') !== 'false';
|
|
3038
|
-
if (active) { state.hidden.add(status); button.setAttribute('aria-pressed', 'false'); }
|
|
3039
|
-
else { state.hidden.delete(status); button.setAttribute('aria-pressed', 'true'); }
|
|
3040
|
-
apply();
|
|
3041
|
-
});
|
|
3042
|
-
});
|
|
3043
|
-
Array.prototype.slice.call(document.querySelectorAll('[data-expand]')).forEach(function (button) {
|
|
3044
|
-
button.addEventListener('click', function () {
|
|
3045
|
-
var open = button.getAttribute('data-expand') === 'all';
|
|
3046
|
-
features.forEach(function (feature) { feature.open = open; });
|
|
3047
|
-
scenarios.forEach(function (scenario) { scenario.open = open; });
|
|
3048
|
-
});
|
|
3049
|
-
});
|
|
3050
|
-
var copyLive = document.getElementById('tolkira-copy-live');
|
|
3051
|
-
function legacyCopy(text) {
|
|
3052
|
-
var active = document.activeElement;
|
|
3053
|
-
var field = document.createElement('textarea');
|
|
3054
|
-
field.value = text;
|
|
3055
|
-
field.setAttribute('readonly', '');
|
|
3056
|
-
field.style.position = 'fixed';
|
|
3057
|
-
field.style.top = '-1000px';
|
|
3058
|
-
document.body.appendChild(field);
|
|
3059
|
-
var ok = false;
|
|
3060
|
-
try {
|
|
3061
|
-
field.select();
|
|
3062
|
-
ok = document.execCommand('copy');
|
|
3063
|
-
} catch (error) {
|
|
3064
|
-
ok = false;
|
|
3065
|
-
} finally {
|
|
3066
|
-
field.remove();
|
|
3067
|
-
if (active && typeof active.focus === 'function') active.focus();
|
|
3068
|
-
}
|
|
3069
|
-
return ok;
|
|
3070
|
-
}
|
|
3071
|
-
function writeClipboard(text, done) {
|
|
3072
|
-
var settled = false;
|
|
3073
|
-
function finish(ok) {
|
|
3074
|
-
if (settled) return;
|
|
3075
|
-
settled = true;
|
|
3076
|
-
done(ok);
|
|
3077
|
-
}
|
|
3078
|
-
function fallback() {
|
|
3079
|
-
finish(legacyCopy(text));
|
|
3080
|
-
}
|
|
3081
|
-
if (navigator.clipboard && typeof navigator.clipboard.writeText === 'function') {
|
|
3082
|
-
try {
|
|
3083
|
-
navigator.clipboard.writeText(text).then(function () { finish(true); }, fallback);
|
|
3084
|
-
} catch (error) {
|
|
3085
|
-
fallback();
|
|
3086
|
-
}
|
|
3087
|
-
} else {
|
|
3088
|
-
fallback();
|
|
3089
|
-
}
|
|
3090
|
-
}
|
|
3091
|
-
function failureText(button) {
|
|
3092
|
-
var scenario = button.closest('[data-scenario]');
|
|
3093
|
-
if (!scenario) return '';
|
|
3094
|
-
var feature = scenario.closest('[data-feature]');
|
|
3095
|
-
var featureTitle = feature ? feature.querySelector('h2') : null;
|
|
3096
|
-
var scenarioTitle = scenario.querySelector('.scenarioName');
|
|
3097
|
-
var step = scenario.querySelector('.step[data-status="failed"]');
|
|
3098
|
-
var keyword = step && step.querySelector('.kw') ? step.querySelector('.kw').textContent.trim() : '';
|
|
3099
|
-
var body = step ? step.querySelector('div') : null;
|
|
3100
|
-
var text = '';
|
|
3101
|
-
if (body) {
|
|
3102
|
-
Array.prototype.forEach.call(body.childNodes, function (node) {
|
|
3103
|
-
if (node.nodeType === 3) text += node.nodeValue;
|
|
3104
|
-
});
|
|
3105
|
-
}
|
|
3106
|
-
var error = step ? step.querySelector('.error') : null;
|
|
3107
|
-
var stepLabel = keyword === 'Hook' ? text.trim() : (keyword + ' ' + text.trim()).trim();
|
|
3108
|
-
var lines = [
|
|
3109
|
-
'Feature: ' + (featureTitle ? featureTitle.textContent : ''),
|
|
3110
|
-
'Scenario: ' + (scenarioTitle ? scenarioTitle.textContent : ''),
|
|
3111
|
-
'URI: ' + (scenario.getAttribute('data-uri') || ''),
|
|
3112
|
-
'Step: ' + stepLabel
|
|
3113
|
-
];
|
|
3114
|
-
if (error && error.textContent.trim()) {
|
|
3115
|
-
lines.push('Error:\\n' + error.textContent.trim());
|
|
3116
|
-
}
|
|
3117
|
-
return lines.join('\\n');
|
|
3118
|
-
}
|
|
3119
|
-
Array.prototype.slice.call(document.querySelectorAll('[data-copy-failure]')).forEach(function (button) {
|
|
3120
|
-
var labelTimer = null;
|
|
3121
|
-
button.addEventListener('click', function () {
|
|
3122
|
-
button.focus();
|
|
3123
|
-
writeClipboard(failureText(button), function (ok) {
|
|
3124
|
-
if (labelTimer) clearTimeout(labelTimer);
|
|
3125
|
-
button.textContent = ok ? 'Copied' : 'Copy failed';
|
|
3126
|
-
if (copyLive) {
|
|
3127
|
-
copyLive.textContent = ok
|
|
3128
|
-
? 'Failure details copied to clipboard.'
|
|
3129
|
-
: 'Could not copy failure details.';
|
|
3130
|
-
}
|
|
3131
|
-
labelTimer = setTimeout(function () {
|
|
3132
|
-
button.textContent = 'Copy failure';
|
|
3133
|
-
if (copyLive) copyLive.textContent = '';
|
|
3134
|
-
}, 2000);
|
|
3135
|
-
});
|
|
3136
|
-
});
|
|
3137
|
-
});
|
|
3138
|
-
var lightbox = document.getElementById('tolkira-lightbox');
|
|
3139
|
-
if (lightbox) {
|
|
3140
|
-
var lightboxImage = lightbox.querySelector('img');
|
|
3141
|
-
var closeLightbox = lightbox.querySelector('[data-lightbox-close]');
|
|
3142
|
-
var lightboxTrigger = null;
|
|
3143
|
-
var previousOverflow = '';
|
|
3144
|
-
function closeDialog() {
|
|
3145
|
-
if (typeof lightbox.close === 'function') lightbox.close();
|
|
3146
|
-
else { lightbox.removeAttribute('open'); restoreLightbox(); }
|
|
3147
|
-
}
|
|
3148
|
-
function restoreLightbox() {
|
|
3149
|
-
document.documentElement.style.overflow = previousOverflow;
|
|
3150
|
-
if (lightboxTrigger) { lightboxTrigger.focus(); lightboxTrigger = null; }
|
|
3151
|
-
}
|
|
3152
|
-
Array.prototype.slice.call(document.querySelectorAll('.shotButton')).forEach(function (button) {
|
|
3153
|
-
button.addEventListener('click', function () {
|
|
3154
|
-
var image = button.querySelector('img');
|
|
3155
|
-
if (!image || !lightboxImage) return;
|
|
3156
|
-
lightboxImage.src = image.src;
|
|
3157
|
-
lightboxImage.alt = image.alt;
|
|
3158
|
-
lightboxTrigger = button;
|
|
3159
|
-
previousOverflow = document.documentElement.style.overflow;
|
|
3160
|
-
document.documentElement.style.overflow = 'hidden';
|
|
3161
|
-
if (typeof lightbox.showModal === 'function') lightbox.showModal();
|
|
3162
|
-
else lightbox.setAttribute('open', '');
|
|
3163
|
-
});
|
|
3164
|
-
});
|
|
3165
|
-
if (closeLightbox) closeLightbox.addEventListener('click', closeDialog);
|
|
3166
|
-
lightbox.addEventListener('click', function (event) { if (event.target === lightbox) closeDialog(); });
|
|
3167
|
-
lightbox.addEventListener('close', restoreLightbox);
|
|
3168
|
-
}
|
|
3169
|
-
function revealHash() {
|
|
3170
|
-
if (!location.hash) return;
|
|
3171
|
-
var id = '';
|
|
3172
|
-
try { id = decodeURIComponent(location.hash.slice(1)); } catch (error) { return; }
|
|
3173
|
-
var target = document.getElementById(id);
|
|
3174
|
-
if (!target) return;
|
|
3175
|
-
var node = target;
|
|
3176
|
-
while (node) {
|
|
3177
|
-
if (node.tagName === 'DETAILS') node.open = true;
|
|
3178
|
-
node = node.parentElement;
|
|
3179
|
-
}
|
|
3180
|
-
var focusTarget = target.tagName === 'DETAILS' ? target.querySelector('summary') : target;
|
|
3181
|
-
if (focusTarget) {
|
|
3182
|
-
try { focusTarget.focus({ preventScroll: true }); } catch (error) { focusTarget.focus(); }
|
|
3183
|
-
}
|
|
3184
|
-
target.scrollIntoView();
|
|
3185
|
-
}
|
|
3186
|
-
var compact = window.matchMedia('(max-width: 560px)');
|
|
3187
|
-
function syncCompact() {
|
|
3188
|
-
if (triage) triage.open = !compact.matches;
|
|
3189
|
-
}
|
|
3190
|
-
if (compact.addEventListener) compact.addEventListener('change', syncCompact);
|
|
3191
|
-
syncCompact();
|
|
3192
|
-
window.addEventListener('hashchange', revealHash);
|
|
3193
|
-
showView('report');
|
|
3194
|
-
revealHash();
|
|
3195
|
-
})();
|
|
3196
|
-
</script>`;
|
|
4072
|
+
).join("")}</div><h2 class="subhead">Run</h2><dl class="metaList">${runRows}</dl>${environmentRows ? `<h2 class="subhead">Cucumber environment</h2><dl class="metaList">${environmentRows}</dl>` : ""}${customRows ? `<h2 class="subhead">Custom metadata</h2><dl class="metaList">${customRows}</dl>` : ""}</section></div>${model.runAttachments.length ? `<section class="panel" style="margin-top:16px"><h2>Run attachments</h2>${model.runAttachments.map((attachment) => renderAttachment(attachment, "Run attachments")).join("")}</section>` : ""}<section class="panel" style="margin-top:16px"><h2>Agent summary</h2><p>The same run as stable JSON for CI tools and agents. Its step counts include hook entries; the HTML counts above exclude them.</p><pre class="json" tabindex="0" aria-label="Agent summary JSON">${escapeHtml(JSON.stringify(preview))}</pre></section><p class="foot">Full summary: <code>tolkira ... --json</code></p></main></div>`;
|
|
4073
|
+
}
|
|
3197
4074
|
function inlineScriptHashes(html) {
|
|
3198
4075
|
const hashes = /* @__PURE__ */ new Set();
|
|
3199
4076
|
for (const match of html.matchAll(/<script\b[^>]*>([\s\S]*?)<\/script>/gi)) {
|
|
@@ -3213,7 +4090,8 @@ async function renderHtml(envelopes, options) {
|
|
|
3213
4090
|
const summary = options.summary ?? summarizeEnvelopes(safeEnvelopes);
|
|
3214
4091
|
const logo = isLogoDataUri(options.logo) ? `<img class="logo" src="${escapeHtml(options.logo)}" alt="">` : "";
|
|
3215
4092
|
const accent = isValidAccent(options.accent) ? `<style>:root{--accent:${options.accent}}</style>` : "";
|
|
3216
|
-
const
|
|
4093
|
+
const clientScript = `<script>${CLIENT_SCRIPT.replace(/<\/script/gi, "<\\/script")}</script>`;
|
|
4094
|
+
const body = `<header class="topbar"><div class="topbarInner"><div class="brand">${logo}tol<span>kira</span></div><div class="views" role="tablist" aria-label="Report view"><button class="view" id="view-report" type="button" role="tab" data-view="report" aria-selected="true" aria-controls="report-view">Report</button><button class="view" id="view-analysis" type="button" role="tab" data-view="analysis" aria-selected="false" aria-controls="analysis-view">Details</button></div></div></header><p class="sr" id="tolkira-copy-live" aria-live="polite"></p>${renderReportView(model, options)}${renderAnalysisView(model, options, summary)}<dialog class="lightbox" id="tolkira-lightbox" aria-label="Full-size attachment"><button class="lightboxClose" type="button" data-lightbox-close>Close</button><img alt=""></dialog>${clientScript}`;
|
|
3217
4095
|
const hashes = inlineScriptHashes(body);
|
|
3218
4096
|
return `<!doctype html>
|
|
3219
4097
|
<html lang="en">
|
|
@@ -3228,8 +4106,29 @@ ${csp(hashes)}
|
|
|
3228
4106
|
</html>`;
|
|
3229
4107
|
}
|
|
3230
4108
|
|
|
4109
|
+
// src/stream.ts
|
|
4110
|
+
import { Transform } from "node:stream";
|
|
4111
|
+
var CucumberHtmlStream = class extends Transform {
|
|
4112
|
+
constructor(options = {}) {
|
|
4113
|
+
super({ objectMode: true });
|
|
4114
|
+
this.options = options;
|
|
4115
|
+
}
|
|
4116
|
+
options;
|
|
4117
|
+
envelopes = [];
|
|
4118
|
+
_transform(envelope, _encoding, callback) {
|
|
4119
|
+
this.envelopes.push(envelope);
|
|
4120
|
+
callback();
|
|
4121
|
+
}
|
|
4122
|
+
_flush(callback) {
|
|
4123
|
+
renderHtml(this.envelopes, renderOptions(this.options)).then(
|
|
4124
|
+
(html) => callback(null, html),
|
|
4125
|
+
(error) => callback(error instanceof Error ? error : new Error(String(error)))
|
|
4126
|
+
);
|
|
4127
|
+
}
|
|
4128
|
+
};
|
|
4129
|
+
|
|
3231
4130
|
// src/index.ts
|
|
3232
|
-
var version = "0.
|
|
4131
|
+
var version = "0.3.0";
|
|
3233
4132
|
var phase = "development";
|
|
3234
4133
|
async function generateReport(inputs, options = {}) {
|
|
3235
4134
|
const groups = await loadInputs(inputs);
|
|
@@ -3237,10 +4136,7 @@ async function generateReport(inputs, options = {}) {
|
|
|
3237
4136
|
const summary = summarizeEnvelopes(envelopes);
|
|
3238
4137
|
return {
|
|
3239
4138
|
html: await renderHtml(envelopes, {
|
|
3240
|
-
|
|
3241
|
-
metadata: options.metadata,
|
|
3242
|
-
logo: options.logo,
|
|
3243
|
-
accent: options.accent,
|
|
4139
|
+
...renderOptions(options),
|
|
3244
4140
|
summary,
|
|
3245
4141
|
provenance: groups.length > 1 ? provenanceFor(groups) : void 0
|
|
3246
4142
|
}),
|
|
@@ -3251,6 +4147,7 @@ async function renderReport(inputs, options = {}) {
|
|
|
3251
4147
|
return (await generateReport(inputs, options)).html;
|
|
3252
4148
|
}
|
|
3253
4149
|
export {
|
|
4150
|
+
CucumberHtmlStream,
|
|
3254
4151
|
SUMMARY_SCHEMA_VERSION,
|
|
3255
4152
|
generateReport,
|
|
3256
4153
|
phase,
|