@qualflare/cucumberjs 0.3.0 → 0.4.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/dist/formatter/index.cjs +38 -1
- package/dist/formatter/index.cjs.map +1 -1
- package/dist/formatter/index.js +38 -1
- package/dist/formatter/index.js.map +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +50 -0
- package/dist/index.d.ts +50 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/formatter/index.cjs
CHANGED
|
@@ -48,6 +48,8 @@ var RESERVED_MESSAGE_MEDIA_TYPE = "application/vnd.qualflare.message+json";
|
|
|
48
48
|
var MAX_SUITES_PER_LAUNCH = 2e3;
|
|
49
49
|
var MAX_CASES_PER_SUITE = 5e3;
|
|
50
50
|
var MAX_TAGS_PER_CASE = 64;
|
|
51
|
+
var MAX_ATTEMPTS_PER_CASE = 50;
|
|
52
|
+
var MAX_ATTEMPT_MESSAGE_RUNES = 8192;
|
|
51
53
|
var MAX_VIDEO_UPLOAD_BYTES = 50 * 1024 * 1024;
|
|
52
54
|
var MAX_STEPS_PER_TEST_ATTEMPT = 300;
|
|
53
55
|
|
|
@@ -526,6 +528,18 @@ function messageDurationToNs(duration) {
|
|
|
526
528
|
return total > 0 ? Math.round(total) : 0;
|
|
527
529
|
}
|
|
528
530
|
|
|
531
|
+
// src/shared/text.ts
|
|
532
|
+
function truncateRunes(value, maxRunes) {
|
|
533
|
+
if (value.length <= maxRunes) {
|
|
534
|
+
return value;
|
|
535
|
+
}
|
|
536
|
+
const runes = Array.from(value);
|
|
537
|
+
if (runes.length <= maxRunes) {
|
|
538
|
+
return value;
|
|
539
|
+
}
|
|
540
|
+
return runes.slice(0, maxRunes).join("");
|
|
541
|
+
}
|
|
542
|
+
|
|
529
543
|
// src/formatter/case-builder.ts
|
|
530
544
|
function combineSteps(realSteps, manualSteps) {
|
|
531
545
|
if (realSteps.length === 0 && manualSteps.length === 0) {
|
|
@@ -544,6 +558,26 @@ function combineSteps(realSteps, manualSteps) {
|
|
|
544
558
|
});
|
|
545
559
|
return [...realSteps, ...offsetManual];
|
|
546
560
|
}
|
|
561
|
+
function buildAttempts(attempts) {
|
|
562
|
+
if (attempts.length < 2) {
|
|
563
|
+
return void 0;
|
|
564
|
+
}
|
|
565
|
+
let kept = attempts;
|
|
566
|
+
if (attempts.length > MAX_ATTEMPTS_PER_CASE) {
|
|
567
|
+
kept = [...attempts.slice(0, MAX_ATTEMPTS_PER_CASE - 1), attempts[attempts.length - 1]];
|
|
568
|
+
}
|
|
569
|
+
return kept.map((a, i) => {
|
|
570
|
+
const attempt = {
|
|
571
|
+
attempt: i + 1,
|
|
572
|
+
status: a.status,
|
|
573
|
+
duration: a.duration
|
|
574
|
+
};
|
|
575
|
+
if (a.error) {
|
|
576
|
+
attempt.message = truncateRunes(a.error, MAX_ATTEMPT_MESSAGE_RUNES);
|
|
577
|
+
}
|
|
578
|
+
return attempt;
|
|
579
|
+
});
|
|
580
|
+
}
|
|
547
581
|
function collapseAttempts(attempts) {
|
|
548
582
|
if (attempts.length === 0) {
|
|
549
583
|
throw new Error("collapseAttempts: at least one attempt is required");
|
|
@@ -552,11 +586,13 @@ function collapseAttempts(attempts) {
|
|
|
552
586
|
const retryCount = attempts.length - 1;
|
|
553
587
|
const isFlaky = retryCount > 0 && final.status === "passed" && attempts.some((a) => a.status !== "passed");
|
|
554
588
|
const duration = attempts.reduce((sum, a) => sum + a.duration, 0);
|
|
589
|
+
const attemptHistory = buildAttempts(attempts);
|
|
555
590
|
return {
|
|
556
591
|
status: final.status,
|
|
557
592
|
duration,
|
|
558
593
|
retryCount,
|
|
559
594
|
isFlaky,
|
|
595
|
+
...attemptHistory ? { attempts: attemptHistory } : {},
|
|
560
596
|
error: final.status === "passed" ? void 0 : final.error,
|
|
561
597
|
steps: combineSteps(final.steps, final.manualSteps),
|
|
562
598
|
labels: final.labels,
|
|
@@ -596,6 +632,7 @@ function buildCase(uri, pickle, collapsed, gherkin) {
|
|
|
596
632
|
duration: collapsed.duration,
|
|
597
633
|
retryCount: collapsed.retryCount || void 0,
|
|
598
634
|
isFlaky: collapsed.isFlaky || void 0,
|
|
635
|
+
attempts: collapsed.attempts,
|
|
599
636
|
error: collapsed.error,
|
|
600
637
|
tags: tags.length > 0 ? tags : void 0,
|
|
601
638
|
steps: collapsed.steps,
|
|
@@ -1001,7 +1038,7 @@ function timestampMs(ts) {
|
|
|
1001
1038
|
var os = __toESM(require("os"), 1);
|
|
1002
1039
|
|
|
1003
1040
|
// src/config/version.ts
|
|
1004
|
-
var PACKAGE_VERSION = "0.
|
|
1041
|
+
var PACKAGE_VERSION = "0.4.0";
|
|
1005
1042
|
|
|
1006
1043
|
// src/formatter/collect-builder.ts
|
|
1007
1044
|
function resolveOs(config) {
|