@jsenv/test 3.3.13 → 3.3.15

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.
@@ -4822,7 +4822,11 @@ const renderConsoleOutput = (consoleCalls) => {
4822
4822
  // and in that case the consoleCall is not suffixed with "\n"
4823
4823
  // we want to keep these calls together in the output
4824
4824
  const regroupedCalls = [];
4825
+ let everyCallIsLog = true;
4825
4826
  consoleCalls.forEach((consoleCall, index) => {
4827
+ if (everyCallIsLog && consoleCall.type !== "log") {
4828
+ everyCallIsLog = false;
4829
+ }
4826
4830
  if (index === 0) {
4827
4831
  regroupedCalls.push(consoleCall);
4828
4832
  return;
@@ -4844,30 +4848,38 @@ const renderConsoleOutput = (consoleCalls) => {
4844
4848
  const previousRegroupedCall = regroupedCalls[previousRegroupedCallIndex];
4845
4849
  previousRegroupedCall.text = `${previousRegroupedCall.text}${consoleCall.text}`;
4846
4850
  });
4847
-
4848
4851
  let consoleOutput = ``;
4849
- regroupedCalls.forEach((regroupedCall, index) => {
4852
+ let index = 0;
4853
+ for (const regroupedCall of regroupedCalls) {
4850
4854
  const text = regroupedCall.text;
4851
4855
  const textFormatted = prefixFirstAndIndentRemainingLines({
4852
- prefix: CONSOLE_ICONS[regroupedCall.type],
4856
+ prefix: everyCallIsLog ? "" : CONSOLE_ICONS[regroupedCall.type],
4853
4857
  text,
4854
4858
  trimLines: false,
4855
4859
  trimLastLine: index === regroupedCalls.length - 1,
4856
4860
  });
4857
4861
  consoleOutput += textFormatted;
4858
- });
4862
+ index++;
4863
+ }
4859
4864
  return consoleOutput;
4860
4865
  };
4861
4866
  const prefixFirstAndIndentRemainingLines = ({
4862
4867
  prefix,
4863
- indentation = " ",
4868
+ indentation,
4864
4869
  text,
4865
4870
  trimLines,
4866
4871
  trimLastLine,
4867
4872
  }) => {
4868
4873
  const lines = text.split(/\r?\n/);
4869
4874
  const firstLine = lines.shift();
4870
- let result = `${prefix} ${firstLine}`;
4875
+ if (indentation === undefined) {
4876
+ if (prefix) {
4877
+ indentation = " "; // prefix + space
4878
+ } else {
4879
+ indentation = "";
4880
+ }
4881
+ }
4882
+ let result = prefix ? `${prefix} ${firstLine}` : firstLine;
4871
4883
  let i = 0;
4872
4884
  while (i < lines.length) {
4873
4885
  const line = trimLines ? lines[i].trim() : lines[i];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsenv/test",
3
- "version": "3.3.13",
3
+ "version": "3.3.15",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -39,7 +39,7 @@
39
39
  "@c88/v8-coverage": "0.1.1",
40
40
  "@jsenv/abort": "4.3.0",
41
41
  "@jsenv/ast": "6.2.5",
42
- "@jsenv/filesystem": "4.8.2",
42
+ "@jsenv/filesystem": "4.9.0",
43
43
  "@jsenv/github-check-run": "0.1.23",
44
44
  "@jsenv/humanize": "1.2.5",
45
45
  "@jsenv/plugin-supervisor": "1.5.6",
@@ -566,7 +566,11 @@ const renderConsoleOutput = (consoleCalls) => {
566
566
  // and in that case the consoleCall is not suffixed with "\n"
567
567
  // we want to keep these calls together in the output
568
568
  const regroupedCalls = [];
569
+ let everyCallIsLog = true;
569
570
  consoleCalls.forEach((consoleCall, index) => {
571
+ if (everyCallIsLog && consoleCall.type !== "log") {
572
+ everyCallIsLog = false;
573
+ }
570
574
  if (index === 0) {
571
575
  regroupedCalls.push(consoleCall);
572
576
  return;
@@ -588,30 +592,38 @@ const renderConsoleOutput = (consoleCalls) => {
588
592
  const previousRegroupedCall = regroupedCalls[previousRegroupedCallIndex];
589
593
  previousRegroupedCall.text = `${previousRegroupedCall.text}${consoleCall.text}`;
590
594
  });
591
-
592
595
  let consoleOutput = ``;
593
- regroupedCalls.forEach((regroupedCall, index) => {
596
+ let index = 0;
597
+ for (const regroupedCall of regroupedCalls) {
594
598
  const text = regroupedCall.text;
595
599
  const textFormatted = prefixFirstAndIndentRemainingLines({
596
- prefix: CONSOLE_ICONS[regroupedCall.type],
600
+ prefix: everyCallIsLog ? "" : CONSOLE_ICONS[regroupedCall.type],
597
601
  text,
598
602
  trimLines: false,
599
603
  trimLastLine: index === regroupedCalls.length - 1,
600
604
  });
601
605
  consoleOutput += textFormatted;
602
- });
606
+ index++;
607
+ }
603
608
  return consoleOutput;
604
609
  };
605
610
  const prefixFirstAndIndentRemainingLines = ({
606
611
  prefix,
607
- indentation = " ",
612
+ indentation,
608
613
  text,
609
614
  trimLines,
610
615
  trimLastLine,
611
616
  }) => {
612
617
  const lines = text.split(/\r?\n/);
613
618
  const firstLine = lines.shift();
614
- let result = `${prefix} ${firstLine}`;
619
+ if (indentation === undefined) {
620
+ if (prefix) {
621
+ indentation = " "; // prefix + space
622
+ } else {
623
+ indentation = "";
624
+ }
625
+ }
626
+ let result = prefix ? `${prefix} ${firstLine}` : firstLine;
615
627
  let i = 0;
616
628
  while (i < lines.length) {
617
629
  const line = trimLines ? lines[i].trim() : lines[i];