webpipe-js 2.0.57 → 2.0.59
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/index.cjs +35 -7
- package/dist/index.mjs +35 -7
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -893,11 +893,19 @@ var Parser = class {
|
|
|
893
893
|
while (true) {
|
|
894
894
|
const save = this.pos;
|
|
895
895
|
this.skipWhitespaceOnly();
|
|
896
|
+
const commentPos = this.pos;
|
|
896
897
|
const comment = this.tryParse(() => this.parseStandaloneComment());
|
|
897
898
|
if (comment) {
|
|
898
|
-
comments.push(comment);
|
|
899
899
|
if (this.cur() === "\n") this.pos++;
|
|
900
|
-
|
|
900
|
+
this.skipWhitespaceOnly();
|
|
901
|
+
const hasFollowingStep = this.text.startsWith("|>", this.pos);
|
|
902
|
+
if (hasFollowingStep || steps.length === 0) {
|
|
903
|
+
comments.push(comment);
|
|
904
|
+
continue;
|
|
905
|
+
} else {
|
|
906
|
+
this.pos = commentPos;
|
|
907
|
+
break;
|
|
908
|
+
}
|
|
901
909
|
}
|
|
902
910
|
for (const keyword of stopKeywords) {
|
|
903
911
|
if (this.text.startsWith(keyword, this.pos)) {
|
|
@@ -922,11 +930,19 @@ var Parser = class {
|
|
|
922
930
|
const comments = [];
|
|
923
931
|
while (true) {
|
|
924
932
|
this.skipWhitespaceOnly();
|
|
933
|
+
const commentPos = this.pos;
|
|
925
934
|
const comment = this.tryParse(() => this.parseStandaloneComment());
|
|
926
935
|
if (comment) {
|
|
927
|
-
comments.push(comment);
|
|
928
936
|
if (this.cur() === "\n") this.pos++;
|
|
929
|
-
|
|
937
|
+
this.skipWhitespaceOnly();
|
|
938
|
+
const hasFollowingStep = this.text.startsWith("|>", this.pos);
|
|
939
|
+
if (hasFollowingStep || steps.length === 0) {
|
|
940
|
+
comments.push(comment);
|
|
941
|
+
continue;
|
|
942
|
+
} else {
|
|
943
|
+
this.pos = commentPos;
|
|
944
|
+
break;
|
|
945
|
+
}
|
|
930
946
|
}
|
|
931
947
|
if (!this.text.startsWith("|>", this.pos)) {
|
|
932
948
|
break;
|
|
@@ -1500,11 +1516,19 @@ var Parser = class {
|
|
|
1500
1516
|
const comments = [];
|
|
1501
1517
|
while (true) {
|
|
1502
1518
|
this.skipWhitespaceOnly();
|
|
1519
|
+
const commentPos = this.pos;
|
|
1503
1520
|
const comment = this.tryParse(() => this.parseStandaloneComment());
|
|
1504
1521
|
if (comment) {
|
|
1505
|
-
comments.push(comment);
|
|
1506
1522
|
if (this.cur() === "\n") this.pos++;
|
|
1507
|
-
|
|
1523
|
+
this.skipWhitespaceOnly();
|
|
1524
|
+
const hasFollowingItem = this.text.startsWith("let ", this.pos) || this.text.startsWith("with mock", this.pos) || this.text.startsWith("and mock", this.pos) || this.text.startsWith("it ", this.pos) || this.text.startsWith('it"', this.pos);
|
|
1525
|
+
if (hasFollowingItem || variables.length === 0 && mocks.length === 0 && tests.length === 0) {
|
|
1526
|
+
comments.push(comment);
|
|
1527
|
+
continue;
|
|
1528
|
+
} else {
|
|
1529
|
+
this.pos = commentPos;
|
|
1530
|
+
break;
|
|
1531
|
+
}
|
|
1508
1532
|
}
|
|
1509
1533
|
const letBinding = this.tryParse(() => this.parseLetBinding());
|
|
1510
1534
|
if (letBinding) {
|
|
@@ -1789,7 +1813,7 @@ function printDescribe(describe) {
|
|
|
1789
1813
|
});
|
|
1790
1814
|
items.sort((a, b) => a.lineNumber - b.lineNumber);
|
|
1791
1815
|
let lastType = null;
|
|
1792
|
-
items.forEach((entry) => {
|
|
1816
|
+
items.forEach((entry, index) => {
|
|
1793
1817
|
if (lastType === "variable" && entry.type !== "variable") {
|
|
1794
1818
|
lines.push("");
|
|
1795
1819
|
}
|
|
@@ -1801,6 +1825,10 @@ function printDescribe(describe) {
|
|
|
1801
1825
|
break;
|
|
1802
1826
|
case "mock":
|
|
1803
1827
|
lines.push(printMock(entry.item));
|
|
1828
|
+
const nextItem = items[index + 1];
|
|
1829
|
+
if (nextItem && nextItem.type === "mock") {
|
|
1830
|
+
lines.push("");
|
|
1831
|
+
}
|
|
1804
1832
|
break;
|
|
1805
1833
|
case "comment":
|
|
1806
1834
|
lines.push(` ${printComment(entry.item)}`);
|
package/dist/index.mjs
CHANGED
|
@@ -840,11 +840,19 @@ var Parser = class {
|
|
|
840
840
|
while (true) {
|
|
841
841
|
const save = this.pos;
|
|
842
842
|
this.skipWhitespaceOnly();
|
|
843
|
+
const commentPos = this.pos;
|
|
843
844
|
const comment = this.tryParse(() => this.parseStandaloneComment());
|
|
844
845
|
if (comment) {
|
|
845
|
-
comments.push(comment);
|
|
846
846
|
if (this.cur() === "\n") this.pos++;
|
|
847
|
-
|
|
847
|
+
this.skipWhitespaceOnly();
|
|
848
|
+
const hasFollowingStep = this.text.startsWith("|>", this.pos);
|
|
849
|
+
if (hasFollowingStep || steps.length === 0) {
|
|
850
|
+
comments.push(comment);
|
|
851
|
+
continue;
|
|
852
|
+
} else {
|
|
853
|
+
this.pos = commentPos;
|
|
854
|
+
break;
|
|
855
|
+
}
|
|
848
856
|
}
|
|
849
857
|
for (const keyword of stopKeywords) {
|
|
850
858
|
if (this.text.startsWith(keyword, this.pos)) {
|
|
@@ -869,11 +877,19 @@ var Parser = class {
|
|
|
869
877
|
const comments = [];
|
|
870
878
|
while (true) {
|
|
871
879
|
this.skipWhitespaceOnly();
|
|
880
|
+
const commentPos = this.pos;
|
|
872
881
|
const comment = this.tryParse(() => this.parseStandaloneComment());
|
|
873
882
|
if (comment) {
|
|
874
|
-
comments.push(comment);
|
|
875
883
|
if (this.cur() === "\n") this.pos++;
|
|
876
|
-
|
|
884
|
+
this.skipWhitespaceOnly();
|
|
885
|
+
const hasFollowingStep = this.text.startsWith("|>", this.pos);
|
|
886
|
+
if (hasFollowingStep || steps.length === 0) {
|
|
887
|
+
comments.push(comment);
|
|
888
|
+
continue;
|
|
889
|
+
} else {
|
|
890
|
+
this.pos = commentPos;
|
|
891
|
+
break;
|
|
892
|
+
}
|
|
877
893
|
}
|
|
878
894
|
if (!this.text.startsWith("|>", this.pos)) {
|
|
879
895
|
break;
|
|
@@ -1447,11 +1463,19 @@ var Parser = class {
|
|
|
1447
1463
|
const comments = [];
|
|
1448
1464
|
while (true) {
|
|
1449
1465
|
this.skipWhitespaceOnly();
|
|
1466
|
+
const commentPos = this.pos;
|
|
1450
1467
|
const comment = this.tryParse(() => this.parseStandaloneComment());
|
|
1451
1468
|
if (comment) {
|
|
1452
|
-
comments.push(comment);
|
|
1453
1469
|
if (this.cur() === "\n") this.pos++;
|
|
1454
|
-
|
|
1470
|
+
this.skipWhitespaceOnly();
|
|
1471
|
+
const hasFollowingItem = this.text.startsWith("let ", this.pos) || this.text.startsWith("with mock", this.pos) || this.text.startsWith("and mock", this.pos) || this.text.startsWith("it ", this.pos) || this.text.startsWith('it"', this.pos);
|
|
1472
|
+
if (hasFollowingItem || variables.length === 0 && mocks.length === 0 && tests.length === 0) {
|
|
1473
|
+
comments.push(comment);
|
|
1474
|
+
continue;
|
|
1475
|
+
} else {
|
|
1476
|
+
this.pos = commentPos;
|
|
1477
|
+
break;
|
|
1478
|
+
}
|
|
1455
1479
|
}
|
|
1456
1480
|
const letBinding = this.tryParse(() => this.parseLetBinding());
|
|
1457
1481
|
if (letBinding) {
|
|
@@ -1736,7 +1760,7 @@ function printDescribe(describe) {
|
|
|
1736
1760
|
});
|
|
1737
1761
|
items.sort((a, b) => a.lineNumber - b.lineNumber);
|
|
1738
1762
|
let lastType = null;
|
|
1739
|
-
items.forEach((entry) => {
|
|
1763
|
+
items.forEach((entry, index) => {
|
|
1740
1764
|
if (lastType === "variable" && entry.type !== "variable") {
|
|
1741
1765
|
lines.push("");
|
|
1742
1766
|
}
|
|
@@ -1748,6 +1772,10 @@ function printDescribe(describe) {
|
|
|
1748
1772
|
break;
|
|
1749
1773
|
case "mock":
|
|
1750
1774
|
lines.push(printMock(entry.item));
|
|
1775
|
+
const nextItem = items[index + 1];
|
|
1776
|
+
if (nextItem && nextItem.type === "mock") {
|
|
1777
|
+
lines.push("");
|
|
1778
|
+
}
|
|
1751
1779
|
break;
|
|
1752
1780
|
case "comment":
|
|
1753
1781
|
lines.push(` ${printComment(entry.item)}`);
|