@@ -2162,7 +2162,7 @@ declare module "fs" {
21622162 } ) ;
21632163
21642164 describe ( "tsc-watch console clearing" , ( ) => {
2165- function checkConsoleClearing ( diagnostics : boolean , extendedDiagnostics : boolean ) {
2165+ function checkConsoleClearing ( options : CompilerOptions = { } ) {
21662166 const file = {
21672167 path : "f.ts" ,
21682168 content : ""
@@ -2172,7 +2172,7 @@ declare module "fs" {
21722172 let clearCount : number | undefined ;
21732173 checkConsoleClears ( ) ;
21742174
2175- createWatchOfFilesAndCompilerOptions ( [ file . path ] , host , { diagnostics , extendedDiagnostics } ) ;
2175+ createWatchOfFilesAndCompilerOptions ( [ file . path ] , host , options ) ;
21762176 checkConsoleClears ( ) ;
21772177
21782178 file . content = "//" ;
@@ -2182,10 +2182,10 @@ declare module "fs" {
21822182 checkConsoleClears ( ) ;
21832183
21842184 function checkConsoleClears ( ) {
2185- if ( clearCount === undefined ) {
2185+ if ( clearCount === undefined || options . preserveWatchOutput ) {
21862186 clearCount = 0 ;
21872187 }
2188- else if ( ! diagnostics && ! extendedDiagnostics ) {
2188+ else if ( ! options . diagnostics && ! options . extendedDiagnostics ) {
21892189 clearCount ++ ;
21902190 }
21912191 host . checkScreenClears ( clearCount ) ;
@@ -2194,13 +2194,22 @@ declare module "fs" {
21942194 }
21952195
21962196 it ( "without --diagnostics or --extendedDiagnostics" , ( ) => {
2197- checkConsoleClearing ( /*diagnostics*/ false , /*extendedDiagnostics*/ false ) ;
2197+ checkConsoleClearing ( ) ;
21982198 } ) ;
21992199 it ( "with --diagnostics" , ( ) => {
2200- checkConsoleClearing ( /*diagnostics*/ true , /*extendedDiagnostics*/ false ) ;
2200+ checkConsoleClearing ( {
2201+ diagnostics : true ,
2202+ } ) ;
22012203 } ) ;
22022204 it ( "with --extendedDiagnostics" , ( ) => {
2203- checkConsoleClearing ( /*diagnostics*/ false , /*extendedDiagnostics*/ true ) ;
2205+ checkConsoleClearing ( {
2206+ extendedDiagnostics : true ,
2207+ } ) ;
2208+ } ) ;
2209+ it ( "with --preserveWatchOutput" , ( ) => {
2210+ checkConsoleClearing ( {
2211+ preserveWatchOutput : true ,
2212+ } ) ;
22042213 } ) ;
22052214 } ) ;
22062215}
0 commit comments