From a389ff5f39c3fa45c34eafc57deb9fee6a1e36b9 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Mon, 4 Dec 2017 23:11:01 -0800 Subject: [PATCH] Unit test failure; clearHostScreen function --- src/compiler/watch.ts | 10 ++++++---- src/harness/unittests/tscWatchMode.ts | 4 ++++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/compiler/watch.ts b/src/compiler/watch.ts index e8fae71597d..35692531d05 100644 --- a/src/compiler/watch.ts +++ b/src/compiler/watch.ts @@ -302,9 +302,7 @@ namespace ts { // There is no extra check needed since we can just rely on the program to decide emit const builder = createBuilder({ getCanonicalFileName, computeHash }); - if (watchingHost.system.clearScreen) { - watchingHost.system.clearScreen(); - } + clearHostScreen(); reportWatchDiagnostic(createCompilerDiagnostic(Diagnostics.Starting_compilation_in_watch_mode)); synchronizeProgram(); @@ -496,10 +494,14 @@ namespace ts { scheduleProgramUpdate(); } - function updateProgram() { + function clearHostScreen() { if (watchingHost.system.clearScreen) { watchingHost.system.clearScreen(); } + } + + function updateProgram() { + clearHostScreen(); timerToUpdateProgram = undefined; reportWatchDiagnostic(createCompilerDiagnostic(Diagnostics.File_change_detected_Starting_incremental_compilation)); diff --git a/src/harness/unittests/tscWatchMode.ts b/src/harness/unittests/tscWatchMode.ts index 8c89c7564f7..e5f994b9fe7 100644 --- a/src/harness/unittests/tscWatchMode.ts +++ b/src/harness/unittests/tscWatchMode.ts @@ -117,6 +117,10 @@ namespace ts.tscWatch { index++; }); if (!skipWaiting) { + if (errorsPosition === ExpectedOutputErrorsPosition.BeforeCompilationStarts) { + assertWatchDiagnosticAt(host, index, ts.Diagnostics.Starting_compilation_in_watch_mode); + index += 1; + } assertWatchDiagnosticAt(host, index, Diagnostics.Compilation_complete_Watching_for_file_changes); } host.clearOutput();