@@ -197,8 +197,8 @@ namespace ts {
197
197
dtsUnchangedExpectedReadFilesDependOrdered = undefined ! ;
198
198
} ) ;
199
199
200
- function createSolutionBuilder ( host : fakes . SolutionBuilderHost ) {
201
- return ts . createSolutionBuilder ( host , [ "/src/third" ] , { dry : false , force : false , verbose : true } ) ;
200
+ function createSolutionBuilder ( host : fakes . SolutionBuilderHost , baseOptions ?: BuildOptions ) {
201
+ return ts . createSolutionBuilder ( host , [ "/src/third" ] , { dry : false , force : false , verbose : true , ... ( baseOptions || { } ) } ) ;
202
202
}
203
203
204
204
function getInitialExpectedReadFiles ( additionalSourceFiles ?: ReadonlyArray < string > ) {
@@ -446,6 +446,49 @@ namespace ts {
446
446
) ;
447
447
} ) ;
448
448
449
+ it ( "rebuilds completely when command line incremental flag changes between non dts changes" , ( ) => {
450
+ const fs = outFileFs . shadow ( ) ;
451
+ // Make non composite third project
452
+ replaceText ( fs , sources [ project . third ] [ source . config ] , `"composite": true,` , "" ) ;
453
+
454
+ // Build with command line incremental
455
+ const host = new fakes . SolutionBuilderHost ( fs ) ;
456
+ const builder = createSolutionBuilder ( host , { incremental : true } ) ;
457
+ builder . buildAllProjects ( ) ;
458
+ host . assertDiagnosticMessages ( ...initialExpectedDiagnostics ) ;
459
+ host . clearDiagnostics ( ) ;
460
+ tick ( ) ;
461
+
462
+ // Make non incremental build with change in file that doesnt affect dts
463
+ appendText ( fs , relSources [ project . first ] [ source . ts ] [ part . one ] , "console.log(s);" ) ;
464
+ builder . resetBuildContext ( { verbose : true } ) ;
465
+ builder . buildAllProjects ( ) ;
466
+ host . assertDiagnosticMessages ( getExpectedDiagnosticForProjectsInBuild ( relSources [ project . first ] [ source . config ] , relSources [ project . second ] [ source . config ] , relSources [ project . third ] [ source . config ] ) ,
467
+ [ Diagnostics . Project_0_is_out_of_date_because_oldest_output_1_is_older_than_newest_input_2 , relSources [ project . first ] [ source . config ] , relOutputFiles [ project . first ] [ ext . js ] , relSources [ project . first ] [ source . ts ] [ part . one ] ] ,
468
+ [ Diagnostics . Building_project_0 , sources [ project . first ] [ source . config ] ] ,
469
+ [ Diagnostics . Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2 , relSources [ project . second ] [ source . config ] , relSources [ project . second ] [ source . ts ] [ part . one ] , relOutputFiles [ project . second ] [ ext . js ] ] ,
470
+ [ Diagnostics . Project_0_is_out_of_date_because_output_of_its_dependency_1_has_changed , relSources [ project . third ] [ source . config ] , "src/first" ] ,
471
+ [ Diagnostics . Building_project_0 , sources [ project . third ] [ source . config ] ]
472
+ ) ;
473
+ host . clearDiagnostics ( ) ;
474
+ tick ( ) ;
475
+
476
+ // Make incremental build with change in file that doesnt affect dts
477
+ appendText ( fs , relSources [ project . first ] [ source . ts ] [ part . one ] , "console.log(s);" ) ;
478
+ builder . resetBuildContext ( { verbose : true , incremental : true } ) ;
479
+ builder . buildAllProjects ( ) ;
480
+ // Builds completely because tsbuildinfo is old.
481
+ host . assertDiagnosticMessages (
482
+ getExpectedDiagnosticForProjectsInBuild ( relSources [ project . first ] [ source . config ] , relSources [ project . second ] [ source . config ] , relSources [ project . third ] [ source . config ] ) ,
483
+ [ Diagnostics . Project_0_is_out_of_date_because_oldest_output_1_is_older_than_newest_input_2 , relSources [ project . first ] [ source . config ] , relOutputFiles [ project . first ] [ ext . js ] , relSources [ project . first ] [ source . ts ] [ part . one ] ] ,
484
+ [ Diagnostics . Building_project_0 , sources [ project . first ] [ source . config ] ] ,
485
+ [ Diagnostics . Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2 , relSources [ project . second ] [ source . config ] , relSources [ project . second ] [ source . ts ] [ part . one ] , relOutputFiles [ project . second ] [ ext . js ] ] ,
486
+ [ Diagnostics . Project_0_is_out_of_date_because_oldest_output_1_is_older_than_newest_input_2 , relSources [ project . third ] [ source . config ] , relOutputFiles [ project . third ] [ ext . buildinfo ] , "src/first" ] ,
487
+ [ Diagnostics . Building_project_0 , sources [ project . third ] [ source . config ] ]
488
+ ) ;
489
+ host . clearDiagnostics ( ) ;
490
+ } ) ;
491
+
449
492
describe ( "Prepend output with .tsbuildinfo" , ( ) => {
450
493
// Prologues
451
494
describe ( "Prologues" , ( ) => {
0 commit comments