@@ -6128,6 +6128,55 @@ namespace ts.projectSystem {
6128
6128
} ) ;
6129
6129
} ) ;
6130
6130
6131
+ describe ( "Subfolder invalidations correctly include parent folder failed lookup locations" , ( ) => {
6132
+ function runFailedLookupTest ( resolution : "Node" | "Classic" ) {
6133
+ const projectLocation = "/proj" ;
6134
+ const file1 : FileOrFolder = {
6135
+ path : `${ projectLocation } /foo/boo/app.ts` ,
6136
+ content : `import * as debug from "debug"`
6137
+ } ;
6138
+ const file2 : FileOrFolder = {
6139
+ path : `${ projectLocation } /foo/boo/moo/app.ts` ,
6140
+ content : `import * as debug from "debug"`
6141
+ } ;
6142
+ const tsconfig : FileOrFolder = {
6143
+ path : `${ projectLocation } /tsconfig.json` ,
6144
+ content : JSON . stringify ( {
6145
+ files : [ "foo/boo/app.ts" , "foo/boo/moo/app.ts" ] ,
6146
+ moduleResolution : resolution
6147
+ } )
6148
+ } ;
6149
+
6150
+ const files = [ file1 , file2 , tsconfig , libFile ] ;
6151
+ const host = createServerHost ( files ) ;
6152
+ const service = createProjectService ( host ) ;
6153
+ service . openClientFile ( file1 . path ) ;
6154
+
6155
+ const project = service . configuredProjects . get ( tsconfig . path ) ;
6156
+ checkProjectActualFiles ( project , files . map ( f => f . path ) ) ;
6157
+ assert . deepEqual ( project . getLanguageService ( ) . getSemanticDiagnostics ( file1 . path ) . map ( diag => diag . messageText ) , [ "Cannot find module 'debug'." ] ) ;
6158
+ assert . deepEqual ( project . getLanguageService ( ) . getSemanticDiagnostics ( file2 . path ) . map ( diag => diag . messageText ) , [ "Cannot find module 'debug'." ] ) ;
6159
+
6160
+ const debugTypesFile : FileOrFolder = {
6161
+ path : `${ projectLocation } /node_modules/debug/index.d.ts` ,
6162
+ content : "export {}"
6163
+ } ;
6164
+ files . push ( debugTypesFile ) ;
6165
+ host . reloadFS ( files ) ;
6166
+ host . runQueuedTimeoutCallbacks ( ) ;
6167
+ checkProjectActualFiles ( project , files . map ( f => f . path ) ) ;
6168
+ assert . deepEqual ( project . getLanguageService ( ) . getSemanticDiagnostics ( file1 . path ) . map ( diag => diag . messageText ) , [ ] ) ;
6169
+ assert . deepEqual ( project . getLanguageService ( ) . getSemanticDiagnostics ( file2 . path ) . map ( diag => diag . messageText ) , [ ] ) ;
6170
+ }
6171
+
6172
+ it ( "Includes the parent folder FLLs in node module resolution mode" , ( ) => {
6173
+ runFailedLookupTest ( "Node" ) ;
6174
+ } ) ;
6175
+ it ( "Includes the parent folder FLLs in classic module resolution mode" , ( ) => {
6176
+ runFailedLookupTest ( "Classic" ) ;
6177
+ } ) ;
6178
+ } ) ;
6179
+
6131
6180
describe ( "Verify npm install in directory with tsconfig file works when" , ( ) => {
6132
6181
function verifyNpmInstall ( timeoutDuringPartialInstallation : boolean ) {
6133
6182
const root = "/user/username/rootfolder/otherfolder" ;
0 commit comments