@jsenv/test 3.7.8 → 3.7.10
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
|
|
|
@@ -4564,7 +4602,7 @@ const mainLegacyResolvers = {
|
|
|
4564
4602
|
};
|
|
4565
4603
|
},
|
|
4566
4604
|
node: ({ packageJson, conditions }) => {
|
|
4567
|
-
if (conditions.includes("import")) {
|
|
4605
|
+
if (conditions.includes("import") && !conditions.includes("require")) {
|
|
4568
4606
|
if (typeof packageJson.module === "string") {
|
|
4569
4607
|
return { type: "field:module", isMain: true, path: packageJson.module };
|
|
4570
4608
|
}
|
|
@@ -4578,6 +4616,7 @@ const mainLegacyResolvers = {
|
|
|
4578
4616
|
return null;
|
|
4579
4617
|
},
|
|
4580
4618
|
};
|
|
4619
|
+
mainLegacyResolvers.require = mainLegacyResolvers.node;
|
|
4581
4620
|
|
|
4582
4621
|
const comparePatternKeys = (keyA, keyB) => {
|
|
4583
4622
|
if (!keyA.endsWith("/") && !keyA.includes("*")) {
|
|
@@ -6548,9 +6587,8 @@ const renderConsoleOutput = (consoleCalls) => {
|
|
|
6548
6587
|
let index = 0;
|
|
6549
6588
|
for (const regroupedCall of regroupedCalls) {
|
|
6550
6589
|
const text = regroupedCall.text;
|
|
6551
|
-
const textFormatted = prefixFirstAndIndentRemainingLines({
|
|
6590
|
+
const textFormatted = prefixFirstAndIndentRemainingLines(text, {
|
|
6552
6591
|
prefix: everyCallIsLog ? "" : CONSOLE_ICONS[regroupedCall.type],
|
|
6553
|
-
text,
|
|
6554
6592
|
trimLines: false,
|
|
6555
6593
|
trimLastLine: index === regroupedCalls.length - 1,
|
|
6556
6594
|
});
|
|
@@ -6559,35 +6597,6 @@ const renderConsoleOutput = (consoleCalls) => {
|
|
|
6559
6597
|
}
|
|
6560
6598
|
return consoleOutput;
|
|
6561
6599
|
};
|
|
6562
|
-
const prefixFirstAndIndentRemainingLines = ({
|
|
6563
|
-
prefix,
|
|
6564
|
-
indentation,
|
|
6565
|
-
text,
|
|
6566
|
-
trimLines,
|
|
6567
|
-
trimLastLine,
|
|
6568
|
-
}) => {
|
|
6569
|
-
const lines = text.split(/\r?\n/);
|
|
6570
|
-
const firstLine = lines.shift();
|
|
6571
|
-
if (indentation === undefined) {
|
|
6572
|
-
if (prefix) {
|
|
6573
|
-
indentation = " "; // prefix + space
|
|
6574
|
-
} else {
|
|
6575
|
-
indentation = "";
|
|
6576
|
-
}
|
|
6577
|
-
}
|
|
6578
|
-
let result = prefix ? `${prefix} ${firstLine}` : firstLine;
|
|
6579
|
-
let i = 0;
|
|
6580
|
-
while (i < lines.length) {
|
|
6581
|
-
const line = trimLines ? lines[i].trim() : lines[i];
|
|
6582
|
-
i++;
|
|
6583
|
-
result += line.length
|
|
6584
|
-
? `\n${indentation}${line}`
|
|
6585
|
-
: trimLastLine && i === lines.length
|
|
6586
|
-
? ""
|
|
6587
|
-
: `\n`;
|
|
6588
|
-
}
|
|
6589
|
-
return result;
|
|
6590
|
-
};
|
|
6591
6600
|
const CONSOLE_ICONS = {
|
|
6592
6601
|
get debug() {
|
|
6593
6602
|
return UNICODE.DEBUG;
|
|
@@ -6626,16 +6635,18 @@ const renderErrors = (execution, logOptions) => {
|
|
|
6626
6635
|
let output = [];
|
|
6627
6636
|
errors.forEach((error) => {
|
|
6628
6637
|
output.push(
|
|
6629
|
-
prefixFirstAndIndentRemainingLines(
|
|
6630
|
-
|
|
6631
|
-
indentation: " ",
|
|
6632
|
-
text: formatErrorForTerminal(error, {
|
|
6638
|
+
prefixFirstAndIndentRemainingLines(
|
|
6639
|
+
formatErrorForTerminal(error, {
|
|
6633
6640
|
rootDirectoryUrl: execution.rootDirectoryUrl,
|
|
6634
6641
|
mainFileRelativeUrl: execution.fileRelativeUrl,
|
|
6635
6642
|
mockFluctuatingValues: logOptions.mockFluctuatingValues,
|
|
6636
6643
|
tryColors: true,
|
|
6637
6644
|
}),
|
|
6638
|
-
|
|
6645
|
+
{
|
|
6646
|
+
prefix: `${UNICODE.CIRCLE_CROSS} `,
|
|
6647
|
+
indentation: " ",
|
|
6648
|
+
},
|
|
6649
|
+
),
|
|
6639
6650
|
);
|
|
6640
6651
|
});
|
|
6641
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.10",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/jsenv/core",
|
|
@@ -35,9 +35,9 @@
|
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@c88/v8-coverage": "0.1.1",
|
|
38
|
-
"@jsenv/ast": "6.7.
|
|
39
|
-
"@jsenv/plugin-supervisor": "1.7.
|
|
40
|
-
"@jsenv/sourcemap": "1.3.
|
|
38
|
+
"@jsenv/ast": "6.7.8",
|
|
39
|
+
"@jsenv/plugin-supervisor": "1.7.5",
|
|
40
|
+
"@jsenv/sourcemap": "1.3.10",
|
|
41
41
|
"he": "1.2.0",
|
|
42
42
|
"istanbul-lib-coverage": "3.2.2",
|
|
43
43
|
"istanbul-lib-instrument": "6.0.3",
|
|
@@ -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({
|