@@ -2313,38 +2313,45 @@ declare module "fs" {
2313
2313
} ) ;
2314
2314
2315
2315
describe ( "tsc-watch console clearing" , ( ) => {
2316
+ const currentDirectoryLog = "Current directory: / CaseSensitiveFileNames: false\n" ;
2317
+ const fileWatcherAddedLog = [
2318
+ "FileWatcher:: Added:: WatchInfo: f.ts 250 Source file\n" ,
2319
+ "FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 250 Source file\n"
2320
+ ] ;
2321
+
2322
+ function getProgramSynchronizingLog ( options : CompilerOptions ) {
2323
+ return [
2324
+ "Synchronizing program\n" ,
2325
+ "CreatingProgramWith::\n" ,
2326
+ " roots: [\"f.ts\"]\n" ,
2327
+ ` options: ${ JSON . stringify ( options ) } \n`
2328
+ ] ;
2329
+ }
2330
+
2316
2331
function checkConsoleClearing ( options : CompilerOptions = { } ) {
2317
2332
const file = {
2318
2333
path : "f.ts" ,
2319
2334
content : ""
2320
2335
} ;
2321
2336
const files = [ file , libFile ] ;
2322
2337
const disableConsoleClear = options . diagnostics || options . extendedDiagnostics || options . preserveWatchOutput ;
2338
+ const hasLog = options . extendedDiagnostics || options . diagnostics ;
2323
2339
const host = createWatchedSystem ( files ) ;
2324
2340
createWatchOfFilesAndCompilerOptions ( [ file . path ] , host , options ) ;
2325
- checkOutputErrorsInitial ( host , emptyArray , disableConsoleClear , options . extendedDiagnostics ? [
2326
- "Current directory: / CaseSensitiveFileNames: false\n" ,
2327
- "Synchronizing program\n" ,
2328
- "CreatingProgramWith::\n" ,
2329
- " roots: [\"f.ts\"]\n" ,
2330
- " options: {\"extendedDiagnostics\":true}\n" ,
2331
- "FileWatcher:: Added:: WatchInfo: f.ts 250 Source file\n" ,
2332
- "FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 250 Source file\n"
2341
+ checkOutputErrorsInitial ( host , emptyArray , disableConsoleClear , hasLog ? [
2342
+ currentDirectoryLog ,
2343
+ ...getProgramSynchronizingLog ( options ) ,
2344
+ ...( options . extendedDiagnostics ? fileWatcherAddedLog : emptyArray )
2333
2345
] : undefined ) ;
2334
2346
2335
2347
file . content = "//" ;
2336
2348
host . reloadFS ( files ) ;
2337
2349
host . runQueuedTimeoutCallbacks ( ) ;
2338
- checkOutputErrorsIncremental ( host , emptyArray , disableConsoleClear , options . extendedDiagnostics ? [
2350
+ checkOutputErrorsIncremental ( host , emptyArray , disableConsoleClear , hasLog ? [
2339
2351
"FileWatcher:: Triggered with /f.ts1:: WatchInfo: f.ts 250 Source file\n" ,
2340
2352
"Scheduling update\n" ,
2341
2353
"Elapsed:: 0ms FileWatcher:: Triggered with /f.ts1:: WatchInfo: f.ts 250 Source file\n"
2342
- ] : undefined , options . extendedDiagnostics ? [
2343
- "Synchronizing program\n" ,
2344
- "CreatingProgramWith::\n" ,
2345
- " roots: [\"f.ts\"]\n" ,
2346
- " options: {\"extendedDiagnostics\":true}\n"
2347
- ] : undefined ) ;
2354
+ ] : undefined , hasLog ? getProgramSynchronizingLog ( options ) : undefined ) ;
2348
2355
}
2349
2356
2350
2357
it ( "without --diagnostics or --extendedDiagnostics" , ( ) => {
0 commit comments