@epikodelabs/testify 1.0.19 → 1.0.20

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.
Files changed (2) hide show
  1. package/bin/testify +55 -6
  2. package/package.json +1 -1
package/bin/testify CHANGED
@@ -705,12 +705,59 @@ class ConsoleReporter {
705
705
  const suiteName = suite.description;
706
706
  let displayDots = this.getSpecDots(suite);
707
707
  const prefix = " ";
708
- const availableWidth = this.lineWidth - prefix.length;
709
- let displayName = suiteName;
710
- const suiteNameLength = displayName.replace(/\.\.\.$/, "").length + (displayName.includes("...") ? 3 : 0);
711
- const dotsLength = this.countVisualDots(displayDots);
712
- let padding = " ".repeat(Math.max(0, availableWidth - suiteNameLength - dotsLength));
713
- this.print(prefix + this.colored("brightBlue", displayName) + padding + displayDots);
708
+ const maxWidth = this.lineWidth;
709
+ const rawSuiteName = suiteName.replace(/\x1b\[[0-9;]*m/g, "");
710
+ let visibleNameLength = rawSuiteName.length;
711
+ let dotsLength = this.countVisualDots(displayDots);
712
+ let availableWidth = maxWidth - prefix.length;
713
+ let displayName = rawSuiteName;
714
+ if (visibleNameLength + dotsLength > availableWidth) {
715
+ let maxNameLen = Math.max(0, availableWidth - dotsLength);
716
+ if (maxNameLen > 0) {
717
+ if (visibleNameLength > maxNameLen) {
718
+ displayName = rawSuiteName.slice(0, Math.max(0, maxNameLen - 1)) + "…";
719
+ visibleNameLength = displayName.length;
720
+ }
721
+ } else {
722
+ displayName = "";
723
+ visibleNameLength = 0;
724
+ }
725
+ }
726
+ if (visibleNameLength + dotsLength > availableWidth) {
727
+ let maxDotsLen = Math.max(0, availableWidth - visibleNameLength);
728
+ let plainDots = displayDots.replace(/\x1b\[[0-9;]*m/g, "");
729
+ [...displayDots.matchAll(/\x1b\[[0-9;]*m/g)];
730
+ let resultDots = "";
731
+ let i = plainDots.length - maxDotsLen;
732
+ if (i < 0) i = 0;
733
+ let skip = i;
734
+ let vis = 0;
735
+ for (let j = 0, k = 0; j < displayDots.length && vis < maxDotsLen; ) {
736
+ if (displayDots[j] === "\x1B") {
737
+ let ansiSeq = displayDots.slice(j).match(/^\x1b\[[0-9;]*m/);
738
+ if (ansiSeq) {
739
+ resultDots += ansiSeq[0];
740
+ j += ansiSeq[0].length;
741
+ continue;
742
+ }
743
+ }
744
+ if (skip > 0) {
745
+ if (displayDots[j] !== "\x1B") {
746
+ skip--;
747
+ }
748
+ j++;
749
+ continue;
750
+ }
751
+ resultDots += displayDots[j];
752
+ vis++;
753
+ j++;
754
+ }
755
+ displayDots = resultDots;
756
+ dotsLength = this.countVisualDots(displayDots);
757
+ }
758
+ let minSpace = " ";
759
+ const spaces = " ".repeat(Math.max(0, maxWidth - prefix.length - visibleNameLength - dotsLength));
760
+ this.print(prefix + this.colored("brightBlue", displayName) + minSpace + spaces + displayDots);
714
761
  if (!isFinal) {
715
762
  this.print("\r");
716
763
  }
@@ -1501,6 +1548,8 @@ class BrowserManager {
1501
1548
  });
1502
1549
  }
1503
1550
  void browser.close().catch(() => {
1551
+ }).finally(() => {
1552
+ process.exit(0);
1504
1553
  });
1505
1554
  };
1506
1555
  const sigintHandler = () => abortRun();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@epikodelabs/testify",
3
- "version": "1.0.19",
3
+ "version": "1.0.20",
4
4
  "description": "Serve and run your Jasmine specs in a browser",
5
5
  "type": "module",
6
6
  "bin": {