@@ -2399,6 +2399,43 @@ namespace ts.projectSystem {
23992399 checkWatchedDirectories ( host , watchedRecursiveDirectories , /*recursive*/ true ) ;
24002400
24012401 } ) ;
2402+
2403+ it ( "Failed lookup locations are uses parent most node_modules directory" , ( ) => {
2404+ const file1 : FileOrFolder = {
2405+ path : "/a/b/src/file1.ts" ,
2406+ content : 'import { classc } from "module1"'
2407+ } ;
2408+ const module1 : FileOrFolder = {
2409+ path : "/a/b/node_modules/module1/index.d.ts" ,
2410+ content : `import { class2 } from "module2";
2411+ export classc { method2a(): class2; }`
2412+ } ;
2413+ const module2 : FileOrFolder = {
2414+ path : "/a/b/node_modules/module2/index.d.ts" ,
2415+ content : "export class2 { method2() { return 10; } }"
2416+ } ;
2417+ const module3 : FileOrFolder = {
2418+ path : "/a/b/node_modules/module/node_modules/module3/index.d.ts" ,
2419+ content : "export class3 { method2() { return 10; } }"
2420+ } ;
2421+ const configFile : FileOrFolder = {
2422+ path : "/a/b/src/tsconfig.json" ,
2423+ content : JSON . stringify ( { files : [ file1 . path ] } )
2424+ } ;
2425+ const files = [ file1 , module1 , module2 , module3 , configFile , libFile ] ;
2426+ const host = createServerHost ( files ) ;
2427+ const projectService = createProjectService ( host ) ;
2428+ projectService . openClientFile ( file1 . path ) ;
2429+ checkNumberOfProjects ( projectService , { configuredProjects : 1 } ) ;
2430+ const project = projectService . configuredProjects . get ( configFile . path ) ;
2431+ assert . isDefined ( project ) ;
2432+ checkProjectActualFiles ( project , [ file1 . path , libFile . path , module1 . path , module2 . path , configFile . path ] ) ;
2433+ checkWatchedFiles ( host , [ libFile . path , module1 . path , module2 . path , configFile . path ] ) ;
2434+ checkWatchedDirectories ( host , [ ] , /*recursive*/ false ) ;
2435+ const watchedRecursiveDirectories = getTypeRootsFromLocation ( "/a/b/src" ) ;
2436+ watchedRecursiveDirectories . push ( "/a/b/src" , "/a/b/node_modules" ) ;
2437+ checkWatchedDirectories ( host , watchedRecursiveDirectories , /*recursive*/ true ) ;
2438+ } ) ;
24022439 } ) ;
24032440
24042441 describe ( "Proper errors" , ( ) => {
0 commit comments