@jsenv/test 3.7.9 → 3.7.11
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/jsenv_test.js
CHANGED
|
@@ -738,6 +738,33 @@ const UNICODE = createUnicode({
|
|
|
738
738
|
ANSI,
|
|
739
739
|
});
|
|
740
740
|
|
|
741
|
+
const prefixFirstAndIndentRemainingLines = (
|
|
742
|
+
text,
|
|
743
|
+
{ prefix, indentation, trimLines, trimLastLine },
|
|
744
|
+
) => {
|
|
745
|
+
const lines = text.split(/\r?\n/);
|
|
746
|
+
const firstLine = lines.shift();
|
|
747
|
+
if (indentation === undefined) {
|
|
748
|
+
if (prefix) {
|
|
749
|
+
indentation = " "; // prefix + space
|
|
750
|
+
} else {
|
|
751
|
+
indentation = "";
|
|
752
|
+
}
|
|
753
|
+
}
|
|
754
|
+
let result = prefix ? `${prefix} ${firstLine}` : firstLine;
|
|
755
|
+
let i = 0;
|
|
756
|
+
while (i < lines.length) {
|
|
757
|
+
const line = trimLines ? lines[i].trim() : lines[i];
|
|
758
|
+
i++;
|
|
759
|
+
result += line.length
|
|
760
|
+
? `\n${indentation}${line}`
|
|
761
|
+
: trimLastLine && i === lines.length
|
|
762
|
+
? ""
|
|
763
|
+
: `\n`;
|
|
764
|
+
}
|
|
765
|
+
return result;
|
|
766
|
+
};
|
|
767
|
+
|
|
741
768
|
const setRoundedPrecision = (
|
|
742
769
|
number,
|
|
743
770
|
{ decimals = 1, decimalsWhenSmall = decimals } = {},
|
|
@@ -3666,13 +3693,24 @@ const defaultLookupPackageScope = (url) => {
|
|
|
3666
3693
|
};
|
|
3667
3694
|
|
|
3668
3695
|
const defaultReadPackageJson = (packageUrl) => {
|
|
3669
|
-
const
|
|
3670
|
-
|
|
3671
|
-
|
|
3696
|
+
const packageJsonFileUrl = new URL("./package.json", packageUrl);
|
|
3697
|
+
let packageJsonFileContentBuffer;
|
|
3698
|
+
try {
|
|
3699
|
+
packageJsonFileContentBuffer = readFileSync(packageJsonFileUrl, "utf8");
|
|
3700
|
+
} catch (e) {
|
|
3701
|
+
if (e.code === "ENOENT") {
|
|
3702
|
+
return null;
|
|
3703
|
+
}
|
|
3704
|
+
throw e;
|
|
3705
|
+
}
|
|
3706
|
+
const packageJsonFileContentString = String(packageJsonFileContentBuffer);
|
|
3672
3707
|
try {
|
|
3673
|
-
|
|
3708
|
+
const packageJsonFileContentObject = JSON.parse(
|
|
3709
|
+
packageJsonFileContentString,
|
|
3710
|
+
);
|
|
3711
|
+
return packageJsonFileContentObject;
|
|
3674
3712
|
} catch {
|
|
3675
|
-
throw new Error(`Invalid package configuration`);
|
|
3713
|
+
throw new Error(`Invalid package configuration at ${packageJsonFileUrl}`);
|
|
3676
3714
|
}
|
|
3677
3715
|
};
|
|
3678
3716
|
|
|
@@ -6549,9 +6587,8 @@ const renderConsoleOutput = (consoleCalls) => {
|
|
|
6549
6587
|
let index = 0;
|
|
6550
6588
|
for (const regroupedCall of regroupedCalls) {
|
|
6551
6589
|
const text = regroupedCall.text;
|
|
6552
|
-
const textFormatted = prefixFirstAndIndentRemainingLines({
|
|
6590
|
+
const textFormatted = prefixFirstAndIndentRemainingLines(text, {
|
|
6553
6591
|
prefix: everyCallIsLog ? "" : CONSOLE_ICONS[regroupedCall.type],
|
|
6554
|
-
text,
|
|
6555
6592
|
trimLines: false,
|
|
6556
6593
|
trimLastLine: index === regroupedCalls.length - 1,
|
|
6557
6594
|
});
|
|
@@ -6560,35 +6597,6 @@ const renderConsoleOutput = (consoleCalls) => {
|
|
|
6560
6597
|
}
|
|
6561
6598
|
return consoleOutput;
|
|
6562
6599
|
};
|
|
6563
|
-
const prefixFirstAndIndentRemainingLines = ({
|
|
6564
|
-
prefix,
|
|
6565
|
-
indentation,
|
|
6566
|
-
text,
|
|
6567
|
-
trimLines,
|
|
6568
|
-
trimLastLine,
|
|
6569
|
-
}) => {
|
|
6570
|
-
const lines = text.split(/\r?\n/);
|
|
6571
|
-
const firstLine = lines.shift();
|
|
6572
|
-
if (indentation === undefined) {
|
|
6573
|
-
if (prefix) {
|
|
6574
|
-
indentation = " "; // prefix + space
|
|
6575
|
-
} else {
|
|
6576
|
-
indentation = "";
|
|
6577
|
-
}
|
|
6578
|
-
}
|
|
6579
|
-
let result = prefix ? `${prefix} ${firstLine}` : firstLine;
|
|
6580
|
-
let i = 0;
|
|
6581
|
-
while (i < lines.length) {
|
|
6582
|
-
const line = trimLines ? lines[i].trim() : lines[i];
|
|
6583
|
-
i++;
|
|
6584
|
-
result += line.length
|
|
6585
|
-
? `\n${indentation}${line}`
|
|
6586
|
-
: trimLastLine && i === lines.length
|
|
6587
|
-
? ""
|
|
6588
|
-
: `\n`;
|
|
6589
|
-
}
|
|
6590
|
-
return result;
|
|
6591
|
-
};
|
|
6592
6600
|
const CONSOLE_ICONS = {
|
|
6593
6601
|
get debug() {
|
|
6594
6602
|
return UNICODE.DEBUG;
|
|
@@ -6627,16 +6635,18 @@ const renderErrors = (execution, logOptions) => {
|
|
|
6627
6635
|
let output = [];
|
|
6628
6636
|
errors.forEach((error) => {
|
|
6629
6637
|
output.push(
|
|
6630
|
-
prefixFirstAndIndentRemainingLines(
|
|
6631
|
-
|
|
6632
|
-
indentation: " ",
|
|
6633
|
-
text: formatErrorForTerminal(error, {
|
|
6638
|
+
prefixFirstAndIndentRemainingLines(
|
|
6639
|
+
formatErrorForTerminal(error, {
|
|
6634
6640
|
rootDirectoryUrl: execution.rootDirectoryUrl,
|
|
6635
6641
|
mainFileRelativeUrl: execution.fileRelativeUrl,
|
|
6636
6642
|
mockFluctuatingValues: logOptions.mockFluctuatingValues,
|
|
6637
6643
|
tryColors: true,
|
|
6638
6644
|
}),
|
|
6639
|
-
|
|
6645
|
+
{
|
|
6646
|
+
prefix: `${UNICODE.CIRCLE_CROSS} `,
|
|
6647
|
+
indentation: " ",
|
|
6648
|
+
},
|
|
6649
|
+
),
|
|
6640
6650
|
);
|
|
6641
6651
|
});
|
|
6642
6652
|
return renderSection({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jsenv/test",
|
|
3
|
-
"version": "3.7.
|
|
3
|
+
"version": "3.7.11",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/jsenv/core",
|
|
@@ -35,8 +35,8 @@
|
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@c88/v8-coverage": "0.1.1",
|
|
38
|
-
"@jsenv/ast": "6.7.
|
|
39
|
-
"@jsenv/plugin-supervisor": "1.7.
|
|
38
|
+
"@jsenv/ast": "6.7.13",
|
|
39
|
+
"@jsenv/plugin-supervisor": "1.7.6",
|
|
40
40
|
"@jsenv/sourcemap": "1.3.10",
|
|
41
41
|
"he": "1.2.0",
|
|
42
42
|
"istanbul-lib-coverage": "3.2.2",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"@jsenv/url-meta": "../../tooling/url-meta",
|
|
66
66
|
"@jsenv/urls": "../../tooling/urls",
|
|
67
67
|
"@jsenv/utils": "../../tooling/utils",
|
|
68
|
-
"prettier": "3.
|
|
68
|
+
"prettier": "3.6.2",
|
|
69
69
|
"strip-ansi": "7.1.0",
|
|
70
70
|
"supports-color": "10.0.0"
|
|
71
71
|
},
|
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
createDynamicLog,
|
|
5
5
|
humanizeDuration,
|
|
6
6
|
humanizeMemory,
|
|
7
|
+
prefixFirstAndIndentRemainingLines,
|
|
7
8
|
renderBigSection,
|
|
8
9
|
renderDetails,
|
|
9
10
|
renderSection,
|
|
@@ -702,9 +703,8 @@ const renderConsoleOutput = (consoleCalls) => {
|
|
|
702
703
|
let index = 0;
|
|
703
704
|
for (const regroupedCall of regroupedCalls) {
|
|
704
705
|
const text = regroupedCall.text;
|
|
705
|
-
const textFormatted = prefixFirstAndIndentRemainingLines({
|
|
706
|
+
const textFormatted = prefixFirstAndIndentRemainingLines(text, {
|
|
706
707
|
prefix: everyCallIsLog ? "" : CONSOLE_ICONS[regroupedCall.type],
|
|
707
|
-
text,
|
|
708
708
|
trimLines: false,
|
|
709
709
|
trimLastLine: index === regroupedCalls.length - 1,
|
|
710
710
|
});
|
|
@@ -713,35 +713,6 @@ const renderConsoleOutput = (consoleCalls) => {
|
|
|
713
713
|
}
|
|
714
714
|
return consoleOutput;
|
|
715
715
|
};
|
|
716
|
-
const prefixFirstAndIndentRemainingLines = ({
|
|
717
|
-
prefix,
|
|
718
|
-
indentation,
|
|
719
|
-
text,
|
|
720
|
-
trimLines,
|
|
721
|
-
trimLastLine,
|
|
722
|
-
}) => {
|
|
723
|
-
const lines = text.split(/\r?\n/);
|
|
724
|
-
const firstLine = lines.shift();
|
|
725
|
-
if (indentation === undefined) {
|
|
726
|
-
if (prefix) {
|
|
727
|
-
indentation = " "; // prefix + space
|
|
728
|
-
} else {
|
|
729
|
-
indentation = "";
|
|
730
|
-
}
|
|
731
|
-
}
|
|
732
|
-
let result = prefix ? `${prefix} ${firstLine}` : firstLine;
|
|
733
|
-
let i = 0;
|
|
734
|
-
while (i < lines.length) {
|
|
735
|
-
const line = trimLines ? lines[i].trim() : lines[i];
|
|
736
|
-
i++;
|
|
737
|
-
result += line.length
|
|
738
|
-
? `\n${indentation}${line}`
|
|
739
|
-
: trimLastLine && i === lines.length
|
|
740
|
-
? ""
|
|
741
|
-
: `\n`;
|
|
742
|
-
}
|
|
743
|
-
return result;
|
|
744
|
-
};
|
|
745
716
|
const CONSOLE_ICONS = {
|
|
746
717
|
get debug() {
|
|
747
718
|
return UNICODE.DEBUG;
|
|
@@ -780,16 +751,18 @@ const renderErrors = (execution, logOptions) => {
|
|
|
780
751
|
let output = [];
|
|
781
752
|
errors.forEach((error) => {
|
|
782
753
|
output.push(
|
|
783
|
-
prefixFirstAndIndentRemainingLines(
|
|
784
|
-
|
|
785
|
-
indentation: " ",
|
|
786
|
-
text: formatErrorForTerminal(error, {
|
|
754
|
+
prefixFirstAndIndentRemainingLines(
|
|
755
|
+
formatErrorForTerminal(error, {
|
|
787
756
|
rootDirectoryUrl: execution.rootDirectoryUrl,
|
|
788
757
|
mainFileRelativeUrl: execution.fileRelativeUrl,
|
|
789
758
|
mockFluctuatingValues: logOptions.mockFluctuatingValues,
|
|
790
759
|
tryColors: true,
|
|
791
760
|
}),
|
|
792
|
-
|
|
761
|
+
{
|
|
762
|
+
prefix: `${UNICODE.CIRCLE_CROSS} `,
|
|
763
|
+
indentation: " ",
|
|
764
|
+
},
|
|
765
|
+
),
|
|
793
766
|
);
|
|
794
767
|
});
|
|
795
768
|
return renderSection({
|