@jsenv/test 3.3.2 → 3.3.4

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/dist/jsenv_test.js +24 -8
  2. package/package.json +7 -7
@@ -740,19 +740,35 @@ const createAnsi = ({ supported }) => {
740
740
  MAGENTA: "\x1b[35m",
741
741
  CYAN: "\x1b[36m",
742
742
  GREY: "\x1b[90m",
743
- color: (text, ANSI_COLOR) => {
744
- return ANSI.supported && ANSI_COLOR
745
- ? `${ANSI_COLOR}${text}${RESET}`
746
- : text;
743
+ color: (text, color) => {
744
+ if (!ANSI.supported) {
745
+ return text;
746
+ }
747
+ if (!color) {
748
+ return text;
749
+ }
750
+ if (typeof text === "string" && text.trim() === "") {
751
+ // cannot set color of blank chars
752
+ return text;
753
+ }
754
+ return `${color}${text}${RESET}`;
747
755
  },
748
756
 
749
757
  BOLD: "\x1b[1m",
750
758
  UNDERLINE: "\x1b[4m",
751
759
  STRIKE: "\x1b[9m",
752
- effect: (text, ANSI_EFFECT) => {
753
- return ANSI.supported && ANSI_EFFECT
754
- ? `${ANSI_EFFECT}${text}${RESET}`
755
- : text;
760
+ effect: (text, effect) => {
761
+ if (!ANSI.supported) {
762
+ return text;
763
+ }
764
+ if (!effect) {
765
+ return text;
766
+ }
767
+ // cannot add effect to empty string
768
+ if (text === "") {
769
+ return text;
770
+ }
771
+ return `${effect}${text}${RESET}`;
756
772
  },
757
773
  };
758
774
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsenv/test",
3
- "version": "3.3.2",
3
+ "version": "3.3.4",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -38,13 +38,13 @@
38
38
  "dependencies": {
39
39
  "@c88/v8-coverage": "0.1.1",
40
40
  "@jsenv/abort": "4.3.0",
41
- "@jsenv/ast": "6.1.2",
42
- "@jsenv/filesystem": "4.7.3",
43
- "@jsenv/github-check-run": "0.1.18",
44
- "@jsenv/humanize": "1.2.0",
45
- "@jsenv/plugin-supervisor": "1.4.14",
41
+ "@jsenv/ast": "6.1.4",
42
+ "@jsenv/filesystem": "4.7.5",
43
+ "@jsenv/github-check-run": "0.1.20",
44
+ "@jsenv/humanize": "1.2.3",
45
+ "@jsenv/plugin-supervisor": "1.4.16",
46
46
  "@jsenv/url-meta": "8.4.2",
47
- "@jsenv/urls": "2.2.8",
47
+ "@jsenv/urls": "2.2.10",
48
48
  "@jsenv/utils": "2.1.1",
49
49
  "istanbul-lib-coverage": "3.2.2",
50
50
  "istanbul-lib-instrument": "6.0.3",