@@ -6045,8 +6045,8 @@ namespace ts.projectSystem {
6045
6045
} ) ;
6046
6046
} ) ;
6047
6047
6048
- describe ( "Subfolder invalidations correctly include parent folder failed lookup locations QJWOP " , ( ) => {
6049
- it ( "Includes the parent folder FLLs" , ( ) => {
6048
+ describe ( "Subfolder invalidations correctly include parent folder failed lookup locations" , ( ) => {
6049
+ function runFailedLookupTest ( resolution : "Node" | "Classic" ) {
6050
6050
const projectLocation = "/proj" ;
6051
6051
const file1 : FileOrFolder = {
6052
6052
path : `${ projectLocation } /foo/boo/app.ts` ,
@@ -6059,7 +6059,8 @@ namespace ts.projectSystem {
6059
6059
const tsconfig : FileOrFolder = {
6060
6060
path : `${ projectLocation } /tsconfig.json` ,
6061
6061
content : JSON . stringify ( {
6062
- files : [ "foo/boo/app.ts" , "foo/boo/moo/app.ts" ]
6062
+ files : [ "foo/boo/app.ts" , "foo/boo/moo/app.ts" ] ,
6063
+ moduleResolution : resolution
6063
6064
} )
6064
6065
} ;
6065
6066
@@ -6083,6 +6084,13 @@ namespace ts.projectSystem {
6083
6084
checkProjectActualFiles ( project , files . map ( f => f . path ) ) ;
6084
6085
assert . deepEqual ( project . getLanguageService ( ) . getSemanticDiagnostics ( file1 . path ) . map ( diag => diag . messageText ) , [ ] ) ;
6085
6086
assert . deepEqual ( project . getLanguageService ( ) . getSemanticDiagnostics ( file2 . path ) . map ( diag => diag . messageText ) , [ ] ) ;
6087
+ }
6088
+
6089
+ it ( "Includes the parent folder FLLs in node module resolution mode" , ( ) => {
6090
+ runFailedLookupTest ( "Node" ) ;
6091
+ } ) ;
6092
+ it ( "Includes the parent folder FLLs in classic module resolution mode" , ( ) => {
6093
+ runFailedLookupTest ( "Classic" ) ;
6086
6094
} ) ;
6087
6095
} ) ;
6088
6096
@@ -6252,6 +6260,44 @@ namespace ts.projectSystem {
6252
6260
verifyNpmInstall ( /*timeoutDuringPartialInstallation*/ false ) ;
6253
6261
} ) ;
6254
6262
} ) ;
6263
+
6264
+ it ( "when node_modules dont receive event for the @types file addition" , ( ) => {
6265
+ const projectLocation = "/user/username/folder/myproject" ;
6266
+ const app : FileOrFolder = {
6267
+ path : `${ projectLocation } /app.ts` ,
6268
+ content : `import * as debug from "debug"`
6269
+ } ;
6270
+ const tsconfig : FileOrFolder = {
6271
+ path : `${ projectLocation } /tsconfig.json` ,
6272
+ content : ""
6273
+ } ;
6274
+
6275
+ const files = [ app , tsconfig , libFile ] ;
6276
+ const host = createServerHost ( files ) ;
6277
+ const service = createProjectService ( host ) ;
6278
+ service . openClientFile ( app . path ) ;
6279
+
6280
+ const project = service . configuredProjects . get ( tsconfig . path ) ;
6281
+ checkProjectActualFiles ( project , files . map ( f => f . path ) ) ;
6282
+ assert . deepEqual ( project . getLanguageService ( ) . getSemanticDiagnostics ( app . path ) . map ( diag => diag . messageText ) , [ "Cannot find module 'debug'." ] ) ;
6283
+
6284
+ const debugTypesFile : FileOrFolder = {
6285
+ path : `${ projectLocation } /node_modules/@types/debug/index.d.ts` ,
6286
+ content : "export {}"
6287
+ } ;
6288
+ files . push ( debugTypesFile ) ;
6289
+ // Do not invoke recursive directory watcher for anything other than node_module/@types
6290
+ const invoker = host . invokeWatchedDirectoriesRecursiveCallback ;
6291
+ host . invokeWatchedDirectoriesRecursiveCallback = ( fullPath , relativePath ) => {
6292
+ if ( fullPath . endsWith ( "@types" ) ) {
6293
+ invoker . call ( host , fullPath , relativePath ) ;
6294
+ }
6295
+ } ;
6296
+ host . reloadFS ( files ) ;
6297
+ host . runQueuedTimeoutCallbacks ( ) ;
6298
+ checkProjectActualFiles ( project , files . map ( f => f . path ) ) ;
6299
+ assert . deepEqual ( project . getLanguageService ( ) . getSemanticDiagnostics ( app . path ) . map ( diag => diag . messageText ) , [ ] ) ;
6300
+ } ) ;
6255
6301
} ) ;
6256
6302
6257
6303
describe ( "tsserverProjectSystem ProjectsChangedInBackground" , ( ) => {
0 commit comments