mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Feedback: correct order in watch.ts; DRY tests
This commit is contained in:
@@ -127,7 +127,7 @@ namespace ts {
|
||||
/**
|
||||
* Helper that emit files, report diagnostics and lists emitted and/or source files depending on compiler options
|
||||
*/
|
||||
export function emitFilesAndReportErrors(program: ProgramToEmitFilesAndReportErrors, reportDiagnostic: DiagnosticReporter, reportSummary?: ReportEmitErrorSummary, writeFileName?: (s: string) => void) {
|
||||
export function emitFilesAndReportErrors(program: ProgramToEmitFilesAndReportErrors, reportDiagnostic: DiagnosticReporter, writeFileName?: (s: string) => void, reportSummary?: ReportEmitErrorSummary) {
|
||||
// First get and report any syntactic errors.
|
||||
const diagnostics = program.getConfigFileParsingDiagnostics().slice();
|
||||
const configFileParsingDiagnosticsLength = diagnostics.length;
|
||||
@@ -242,7 +242,7 @@ namespace ts {
|
||||
}
|
||||
};
|
||||
|
||||
emitFilesAndReportErrors(builderProgram, reportDiagnostic, reportSummary, writeFileName);
|
||||
emitFilesAndReportErrors(builderProgram, reportDiagnostic, writeFileName, reportSummary);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -128,6 +128,12 @@ namespace ts.tscWatch {
|
||||
}
|
||||
}
|
||||
|
||||
function createErrorsFoundCompilerDiagnostic(errors: ReadonlyArray<Diagnostic>) {
|
||||
return errors.length === 1
|
||||
? createCompilerDiagnostic(Diagnostics.Found_1_error)
|
||||
: createCompilerDiagnostic(Diagnostics.Found_0_errors, errors.length);
|
||||
}
|
||||
|
||||
function checkOutputErrorsInitial(host: WatchedSystem, errors: ReadonlyArray<Diagnostic>, disableConsoleClears?: boolean, logsBeforeErrors?: string[]) {
|
||||
checkOutputErrors(
|
||||
host,
|
||||
@@ -136,9 +142,7 @@ namespace ts.tscWatch {
|
||||
logsBeforeErrors,
|
||||
errors,
|
||||
disableConsoleClears,
|
||||
errors.length === 1
|
||||
? createCompilerDiagnostic(Diagnostics.Found_1_error)
|
||||
: createCompilerDiagnostic(Diagnostics.Found_0_errors, errors.length),
|
||||
createErrorsFoundCompilerDiagnostic(errors),
|
||||
createCompilerDiagnostic(Diagnostics.Compilation_complete_Watching_for_file_changes));
|
||||
}
|
||||
|
||||
@@ -150,9 +154,7 @@ namespace ts.tscWatch {
|
||||
logsBeforeErrors,
|
||||
errors,
|
||||
disableConsoleClears,
|
||||
errors.length === 1
|
||||
? createCompilerDiagnostic(Diagnostics.Found_1_error)
|
||||
: createCompilerDiagnostic(Diagnostics.Found_0_errors, errors.length),
|
||||
createErrorsFoundCompilerDiagnostic(errors),
|
||||
createCompilerDiagnostic(Diagnostics.Compilation_complete_Watching_for_file_changes));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user