@@ -2162,7 +2162,7 @@ declare module "fs" {
2162
2162
} ) ;
2163
2163
2164
2164
describe ( "tsc-watch console clearing" , ( ) => {
2165
- function checkConsoleClearing ( diagnostics : boolean , extendedDiagnostics : boolean ) {
2165
+ function checkConsoleClearing ( options : CompilerOptions = { } ) {
2166
2166
const file = {
2167
2167
path : "f.ts" ,
2168
2168
content : ""
@@ -2172,7 +2172,7 @@ declare module "fs" {
2172
2172
let clearCount : number | undefined ;
2173
2173
checkConsoleClears ( ) ;
2174
2174
2175
- createWatchOfFilesAndCompilerOptions ( [ file . path ] , host , { diagnostics , extendedDiagnostics } ) ;
2175
+ createWatchOfFilesAndCompilerOptions ( [ file . path ] , host , options ) ;
2176
2176
checkConsoleClears ( ) ;
2177
2177
2178
2178
file . content = "//" ;
@@ -2182,10 +2182,10 @@ declare module "fs" {
2182
2182
checkConsoleClears ( ) ;
2183
2183
2184
2184
function checkConsoleClears ( ) {
2185
- if ( clearCount === undefined ) {
2185
+ if ( clearCount === undefined || options . preserveWatchOutput ) {
2186
2186
clearCount = 0 ;
2187
2187
}
2188
- else if ( ! diagnostics && ! extendedDiagnostics ) {
2188
+ else if ( ! options . diagnostics && ! options . extendedDiagnostics ) {
2189
2189
clearCount ++ ;
2190
2190
}
2191
2191
host . checkScreenClears ( clearCount ) ;
@@ -2194,13 +2194,22 @@ declare module "fs" {
2194
2194
}
2195
2195
2196
2196
it ( "without --diagnostics or --extendedDiagnostics" , ( ) => {
2197
- checkConsoleClearing ( /*diagnostics*/ false , /*extendedDiagnostics*/ false ) ;
2197
+ checkConsoleClearing ( ) ;
2198
2198
} ) ;
2199
2199
it ( "with --diagnostics" , ( ) => {
2200
- checkConsoleClearing ( /*diagnostics*/ true , /*extendedDiagnostics*/ false ) ;
2200
+ checkConsoleClearing ( {
2201
+ diagnostics : true ,
2202
+ } ) ;
2201
2203
} ) ;
2202
2204
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
+ } ) ;
2204
2213
} ) ;
2205
2214
} ) ;
2206
2215
}
0 commit comments