Skip to content

Commit

Permalink
move hidden lines to stats printer
Browse files Browse the repository at this point in the history
  • Loading branch information
vankop committed Mar 4, 2022
1 parent 8f8ba91 commit c14f187
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
6 changes: 1 addition & 5 deletions lib/stats/DefaultStatsFactoryPlugin.js
Expand Up @@ -1825,11 +1825,7 @@ const errorsSpaceLimit = (errors, max) => {
const overlimit = fullLength - max + 1;
result.push({
...errors[i++],
details: `${splitted
.slice(0, len - overlimit)
.join("\n")}\n+${overlimit} hidden line${
overlimit === 1 ? "" : "s"
}`
filteredDetails: overlimit
});
filtered = errors.length - i;
for (; i < errors.length; i++) {
Expand Down
11 changes: 10 additions & 1 deletion lib/stats/DefaultStatsPrinterPlugin.js
Expand Up @@ -588,7 +588,14 @@ const SIMPLE_PRINTERS = {
"error.loc": (loc, { green }) => green(loc),
"error.message": (message, { bold, formatError }) =>
message.includes("\u001b[") ? message : bold(formatError(message)),
"error.details": (details, { formatError }) => formatError(details),
"error.details": (details, { formatError, error }) => {
if (!error.filteredDetails) return formatError(details);
return formatError(
details.split("\n").slice(0, -error.filteredDetails).join("\n")
);
},
"error.filteredDetails": filteredDetails =>
filteredDetails ? `+ ${filteredDetails} hidden lines` : undefined,
"error.stack": stack => stack,
"error.moduleTrace": moduleTrace => undefined,
"error.separator!": () => "\n",
Expand Down Expand Up @@ -689,6 +696,8 @@ const ERROR_PREFERRED_ORDER = [
"separator!",
"details",
"separator!",
"filteredDetails",
"separator!",
"stack",
"separator!",
"missing",
Expand Down
2 changes: 1 addition & 1 deletion test/__snapshots__/StatsTestCases.basictest.js.snap
Expand Up @@ -1073,7 +1073,7 @@ ERROR in ./index.js (./loader.js!./index.js)
Module Error (from ./loader.js):
loader error1
stack1
+2 hidden lines
+ 2 hidden lines
ERROR in ./index.js (./loader.js!./index.js)
Module Error (from ./loader.js):
Expand Down

0 comments on commit c14f187

Please sign in to comment.