MCPcopy Create free account
hub / github.com/nodejs/node / getErrorSummaryText

Function getErrorSummaryText

test/fixtures/snapshot/typescript.js:122812–122830  ·  view source on GitHub ↗
(errorCount, filesInError, newLine, host)

Source from the content-addressed store, hash-verified

122810 return error.fileName + line;
122811 }
122812 function getErrorSummaryText(errorCount, filesInError, newLine, host) {
122813 if (errorCount === 0)
122814 return "";
122815 var nonNilFiles = filesInError.filter(function (fileInError) { return fileInError !== undefined; });
122816 var distinctFileNamesWithLines = nonNilFiles.map(function (fileInError) { return "".concat(fileInError.fileName, ":").concat(fileInError.line); })
122817 .filter(function (value, index, self) { return self.indexOf(value) === index; });
122818 var firstFileReference = nonNilFiles[0] && prettyPathForFileError(nonNilFiles[0], host.getCurrentDirectory());
122819 var d = errorCount === 1 ?
122820 ts.createCompilerDiagnostic(filesInError[0] !== undefined ?
122821 ts.Diagnostics.Found_1_error_in_1 :
122822 ts.Diagnostics.Found_1_error, errorCount, firstFileReference) :
122823 ts.createCompilerDiagnostic(distinctFileNamesWithLines.length === 0 ?
122824 ts.Diagnostics.Found_0_errors :
122825 distinctFileNamesWithLines.length === 1 ?
122826 ts.Diagnostics.Found_0_errors_in_the_same_file_starting_at_Colon_1 :
122827 ts.Diagnostics.Found_0_errors_in_1_files, errorCount, distinctFileNamesWithLines.length === 1 ? firstFileReference : distinctFileNamesWithLines.length);
122828 var suffix = distinctFileNamesWithLines.length > 1 ? createTabularErrorsDisplay(nonNilFiles, host) : "";
122829 return "".concat(newLine).concat(ts.flattenDiagnosticMessageText(d.messageText, newLine)).concat(newLine).concat(newLine).concat(suffix);
122830 }
122831 ts.getErrorSummaryText = getErrorSummaryText;
122832 function createTabularErrorsDisplay(filesInError, host) {
122833 var distinctFiles = filesInError.filter(function (value, index, self) { return index === self.findIndex(function (file) { return (file === null || file === void 0 ? void 0 : file.fileName) === (value === null || value === void 0 ? void 0 : value.fileName); }); });

Callers 1

Calls 6

prettyPathForFileErrorFunction · 0.85
concatMethod · 0.80
filterMethod · 0.65
mapMethod · 0.65
indexOfMethod · 0.45

Tested by

no test coverage detected