fix(45713) Improve error report summaries (#45742)

* Improve error report summaries (#45713)

* fixup! Improve error report summaries (#45713)

* fixup! fixup! Improve error report summaries (#45713)

* Adds support for handling localization renaming the 'files' header due to localization

* fixup! Adds support for handling localization renaming the 'files' header due to localization

 - Fixed baseline error
 - Fixed linter error

Co-authored-by: Orta <git@orta.io>
Co-authored-by: Orta Therox <ortam@microsoft.com>
This commit is contained in:
Ryan Bargholz
2021-12-07 19:50:44 +09:00
committed by GitHub
parent 305842bd9e
commit 7a12909ae3
50 changed files with 575 additions and 98 deletions

View File

@@ -54,7 +54,7 @@ export function f22() { } // trailing`,
/*createProgram*/ undefined,
createDiagnosticReporter(sys, /*pretty*/ true),
createBuilderStatusReporter(sys, /*pretty*/ true),
errorCount => sys.write(getErrorSummaryText(errorCount, sys.newLine))
(errorCount, filesInError) => sys.write(getErrorSummaryText(errorCount, filesInError, sys.newLine))
);
buildHost.afterProgramEmitAndDiagnostics = cb;
buildHost.afterEmitBundle = cb;

View File

@@ -204,13 +204,18 @@ namespace ts.tscWatch {
assert.equal(host.exitCode, expectedExitCode);
}
export function checkNormalBuildErrors(host: WatchedSystem, errors: readonly Diagnostic[] | readonly string[], reportErrorSummary?: boolean) {
export function checkNormalBuildErrors(
host: WatchedSystem,
errors: readonly Diagnostic[] | readonly string[],
files: readonly ReportFileInError[],
reportErrorSummary?: boolean
) {
checkOutputErrors(
host,
[
...map(errors, hostOutputDiagnostic),
...reportErrorSummary ?
[hostOutputWatchDiagnostic(getErrorSummaryText(errors.length, host.newLine))] :
[hostOutputWatchDiagnostic(getErrorSummaryText(errors.length, files, host.newLine))] :
emptyArray
]
);