@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.js
CHANGED
|
@@ -12,6 +12,8 @@ var RESERVED_MESSAGE_MEDIA_TYPE = "application/vnd.qualflare.message+json";
|
|
|
12
12
|
var MAX_SUITES_PER_LAUNCH = 2e3;
|
|
13
13
|
var MAX_CASES_PER_SUITE = 5e3;
|
|
14
14
|
var MAX_TAGS_PER_CASE = 64;
|
|
15
|
+
var MAX_ATTEMPTS_PER_CASE = 50;
|
|
16
|
+
var MAX_ATTEMPT_MESSAGE_RUNES = 8192;
|
|
15
17
|
var MAX_VIDEO_UPLOAD_BYTES = 50 * 1024 * 1024;
|
|
16
18
|
var MAX_STEPS_PER_TEST_ATTEMPT = 300;
|
|
17
19
|
|
|
@@ -492,6 +494,18 @@ function messageDurationToNs(duration) {
|
|
|
492
494
|
return total > 0 ? Math.round(total) : 0;
|
|
493
495
|
}
|
|
494
496
|
|
|
497
|
+
// src/shared/text.ts
|
|
498
|
+
function truncateRunes(value, maxRunes) {
|
|
499
|
+
if (value.length <= maxRunes) {
|
|
500
|
+
return value;
|
|
501
|
+
}
|
|
502
|
+
const runes = Array.from(value);
|
|
503
|
+
if (runes.length <= maxRunes) {
|
|
504
|
+
return value;
|
|
505
|
+
}
|
|
506
|
+
return runes.slice(0, maxRunes).join("");
|
|
507
|
+
}
|
|
508
|
+
|
|
495
509
|
// src/formatter/case-builder.ts
|
|
496
510
|
function combineSteps(realSteps, manualSteps) {
|
|
497
511
|
if (realSteps.length === 0 && manualSteps.length === 0) {
|
|
@@ -510,6 +524,26 @@ function combineSteps(realSteps, manualSteps) {
|
|
|
510
524
|
});
|
|
511
525
|
return [...realSteps, ...offsetManual];
|
|
512
526
|
}
|
|
527
|
+
function buildAttempts(attempts) {
|
|
528
|
+
if (attempts.length < 2) {
|
|
529
|
+
return void 0;
|
|
530
|
+
}
|
|
531
|
+
let kept = attempts;
|
|
532
|
+
if (attempts.length > MAX_ATTEMPTS_PER_CASE) {
|
|
533
|
+
kept = [...attempts.slice(0, MAX_ATTEMPTS_PER_CASE - 1), attempts[attempts.length - 1]];
|
|
534
|
+
}
|
|
535
|
+
return kept.map((a, i) => {
|
|
536
|
+
const attempt = {
|
|
537
|
+
attempt: i + 1,
|
|
538
|
+
status: a.status,
|
|
539
|
+
duration: a.duration
|
|
540
|
+
};
|
|
541
|
+
if (a.error) {
|
|
542
|
+
attempt.message = truncateRunes(a.error, MAX_ATTEMPT_MESSAGE_RUNES);
|
|
543
|
+
}
|
|
544
|
+
return attempt;
|
|
545
|
+
});
|
|
546
|
+
}
|
|
513
547
|
function collapseAttempts(attempts) {
|
|
514
548
|
if (attempts.length === 0) {
|
|
515
549
|
throw new Error("collapseAttempts: at least one attempt is required");
|
|
@@ -518,11 +552,13 @@ function collapseAttempts(attempts) {
|
|
|
518
552
|
const retryCount = attempts.length - 1;
|
|
519
553
|
const isFlaky = retryCount > 0 && final.status === "passed" && attempts.some((a) => a.status !== "passed");
|
|
520
554
|
const duration = attempts.reduce((sum, a) => sum + a.duration, 0);
|
|
555
|
+
const attemptHistory = buildAttempts(attempts);
|
|
521
556
|
return {
|
|
522
557
|
status: final.status,
|
|
523
558
|
duration,
|
|
524
559
|
retryCount,
|
|
525
560
|
isFlaky,
|
|
561
|
+
...attemptHistory ? { attempts: attemptHistory } : {},
|
|
526
562
|
error: final.status === "passed" ? void 0 : final.error,
|
|
527
563
|
steps: combineSteps(final.steps, final.manualSteps),
|
|
528
564
|
labels: final.labels,
|
|
@@ -562,6 +598,7 @@ function buildCase(uri, pickle, collapsed, gherkin) {
|
|
|
562
598
|
duration: collapsed.duration,
|
|
563
599
|
retryCount: collapsed.retryCount || void 0,
|
|
564
600
|
isFlaky: collapsed.isFlaky || void 0,
|
|
601
|
+
attempts: collapsed.attempts,
|
|
565
602
|
error: collapsed.error,
|
|
566
603
|
tags: tags.length > 0 ? tags : void 0,
|
|
567
604
|
steps: collapsed.steps,
|
|
@@ -967,7 +1004,7 @@ function timestampMs(ts) {
|
|
|
967
1004
|
import * as os from "os";
|
|
968
1005
|
|
|
969
1006
|
// src/config/version.ts
|
|
970
|
-
var PACKAGE_VERSION = "0.
|
|
1007
|
+
var PACKAGE_VERSION = "0.4.0";
|
|
971
1008
|
|
|
972
1009
|
// src/formatter/collect-builder.ts
|
|
973
1010
|
function resolveOs(config) {
|