@@ -356,6 +356,58 @@ function myFunc() { return 100; }`);
356
356
}
357
357
} ) ;
358
358
359
+ it ( "when referenced project change introduces error in the down stream project and then fixes it" , ( ) => {
360
+ const subProjectLibrary = `${ projectsLocation } /${ project } /Library` ;
361
+ const libraryTs : File = {
362
+ path : `${ subProjectLibrary } /library.ts` ,
363
+ content : `
364
+ interface SomeObject
365
+ {
366
+ message: string;
367
+ }
368
+
369
+ export function createSomeObject(): SomeObject
370
+ {
371
+ return {
372
+ message: "new Object"
373
+ };
374
+ }`
375
+ } ;
376
+ const libraryTsconfig : File = {
377
+ path : `${ subProjectLibrary } /tsconfig.json` ,
378
+ content : JSON . stringify ( { compilerOptions : { composite : true } } )
379
+ } ;
380
+ const subProjectApp = `${ projectsLocation } /${ project } /App` ;
381
+ const appTs : File = {
382
+ path : `${ subProjectApp } /app.ts` ,
383
+ content : `import { createSomeObject } from "../Library/library";
384
+ createSomeObject().message;`
385
+ } ;
386
+ const appTsconfig : File = {
387
+ path : `${ subProjectApp } /tsconfig.json` ,
388
+ content : JSON . stringify ( { references : [ { path : "../Library" } ] } )
389
+ } ;
390
+
391
+ const files = [ libFile , libraryTs , libraryTsconfig , appTs , appTsconfig ] ;
392
+ const host = createWatchedSystem ( files , { currentDirectory : `${ projectsLocation } /${ project } ` } ) ;
393
+ createSolutionBuilderWithWatch ( host , [ "App" ] ) ;
394
+ checkOutputErrorsInitial ( host , emptyArray ) ;
395
+
396
+ // Change message in library to message2
397
+ host . writeFile ( libraryTs . path , libraryTs . content . replace ( / m e s s a g e / g, "message2" ) ) ;
398
+ host . checkTimeoutQueueLengthAndRun ( 1 ) ; // Build library
399
+ host . checkTimeoutQueueLengthAndRun ( 1 ) ; // Build App
400
+ checkOutputErrorsIncremental ( host , [
401
+ "App/app.ts(2,20): error TS2551: Property 'message' does not exist on type 'SomeObject'. Did you mean 'message2'?\n"
402
+ ] ) ;
403
+
404
+ // Revert library changes
405
+ host . writeFile ( libraryTs . path , libraryTs . content ) ;
406
+ host . checkTimeoutQueueLengthAndRun ( 1 ) ; // Build library
407
+ host . checkTimeoutQueueLengthAndRun ( 1 ) ; // Build App
408
+ checkOutputErrorsIncremental ( host , emptyArray ) ;
409
+ } ) ;
410
+
359
411
describe ( "reports errors in all projects on incremental compile" , ( ) => {
360
412
function verifyIncrementalErrors ( defaultBuildOptions ?: BuildOptions , disabledConsoleClear ?: boolean ) {
361
413
const host = createSolutionInWatchMode ( allFiles , defaultBuildOptions , disabledConsoleClear ) ;
0 commit comments