@@ -2313,38 +2313,45 @@ declare module "fs" {
23132313 } ) ;
23142314
23152315 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+
23162331 function checkConsoleClearing ( options : CompilerOptions = { } ) {
23172332 const file = {
23182333 path : "f.ts" ,
23192334 content : ""
23202335 } ;
23212336 const files = [ file , libFile ] ;
23222337 const disableConsoleClear = options . diagnostics || options . extendedDiagnostics || options . preserveWatchOutput ;
2338+ const hasLog = options . extendedDiagnostics || options . diagnostics ;
23232339 const host = createWatchedSystem ( files ) ;
23242340 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 )
23332345 ] : undefined ) ;
23342346
23352347 file . content = "//" ;
23362348 host . reloadFS ( files ) ;
23372349 host . runQueuedTimeoutCallbacks ( ) ;
2338- checkOutputErrorsIncremental ( host , emptyArray , disableConsoleClear , options . extendedDiagnostics ? [
2350+ checkOutputErrorsIncremental ( host , emptyArray , disableConsoleClear , hasLog ? [
23392351 "FileWatcher:: Triggered with /f.ts1:: WatchInfo: f.ts 250 Source file\n" ,
23402352 "Scheduling update\n" ,
23412353 "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 ) ;
23482355 }
23492356
23502357 it ( "without --diagnostics or --extendedDiagnostics" , ( ) => {
0 commit comments