Skip to content

Commit a389ff5

Browse files
author
Josh Goldberg
committed
Unit test failure; clearHostScreen function
1 parent a4f83b0 commit a389ff5

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

src/compiler/watch.ts

+6-4
Original file line numberDiff line numberDiff line change
@@ -302,9 +302,7 @@ namespace ts {
302302
// There is no extra check needed since we can just rely on the program to decide emit
303303
const builder = createBuilder({ getCanonicalFileName, computeHash });
304304

305-
if (watchingHost.system.clearScreen) {
306-
watchingHost.system.clearScreen();
307-
}
305+
clearHostScreen();
308306
reportWatchDiagnostic(createCompilerDiagnostic(Diagnostics.Starting_compilation_in_watch_mode));
309307
synchronizeProgram();
310308

@@ -496,10 +494,14 @@ namespace ts {
496494
scheduleProgramUpdate();
497495
}
498496

499-
function updateProgram() {
497+
function clearHostScreen() {
500498
if (watchingHost.system.clearScreen) {
501499
watchingHost.system.clearScreen();
502500
}
501+
}
502+
503+
function updateProgram() {
504+
clearHostScreen();
503505

504506
timerToUpdateProgram = undefined;
505507
reportWatchDiagnostic(createCompilerDiagnostic(Diagnostics.File_change_detected_Starting_incremental_compilation));

src/harness/unittests/tscWatchMode.ts

+4
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,10 @@ namespace ts.tscWatch {
117117
index++;
118118
});
119119
if (!skipWaiting) {
120+
if (errorsPosition === ExpectedOutputErrorsPosition.BeforeCompilationStarts) {
121+
assertWatchDiagnosticAt(host, index, ts.Diagnostics.Starting_compilation_in_watch_mode);
122+
index += 1;
123+
}
120124
assertWatchDiagnosticAt(host, index, Diagnostics.Compilation_complete_Watching_for_file_changes);
121125
}
122126
host.clearOutput();

0 commit comments

Comments
 (0)