@@ -9,6 +9,7 @@ const libraryBPath = path.join(__dirname, "..", "fixtures", "collection", "libra
99// const libraryCPath = path.join(__dirname, "..", "fixtures", "collection", "library.c");
1010const libraryDPath = path . join ( __dirname , ".." , "fixtures" , "library.d" ) ;
1111const cycleDepsBasePath = path . join ( __dirname , ".." , "fixtures" , "cyclic-deps" , "node_modules" ) ;
12+ const pathToInvalidModule = path . join ( __dirname , ".." , "fixtures" , "invalidModule" ) ;
1213
1314test ( "Project with inline configuration" , ( t ) => {
1415 const tree = {
@@ -533,9 +534,153 @@ test("Project tree B with inline configs", (t) => {
533534 } ) ;
534535} ) ;
535536
537+ test ( "Project with nested invalid dependencies" , ( t ) => {
538+ return projectPreprocessor . processTree ( treeWithInvalidModules ) . then ( ( parsedTree ) => {
539+ t . deepEqual ( expectedTreeWithInvalidModules , parsedTree ) ;
540+ } ) ;
541+ } ) ;
542+
536543/* ========================= */
537544/* ======= Test data ======= */
538545
546+ /* === Invalid Modules */
547+ const treeWithInvalidModules = {
548+ id : "application.a" ,
549+ path : applicationAPath ,
550+ dependencies : [
551+ // A
552+ {
553+ id : "library.a" ,
554+ path : libraryAPath ,
555+ dependencies : [
556+ {
557+ // C - invalid - should be missing in preprocessed tree
558+ id : "module.c" ,
559+ dependencies : [ ] ,
560+ path : pathToInvalidModule ,
561+ version : "1.0.0"
562+ } ,
563+ {
564+ // D - invalid - should be missing in preprocessed tree
565+ id : "module.d" ,
566+ dependencies : [ ] ,
567+ path : pathToInvalidModule ,
568+ version : "1.0.0"
569+ }
570+ ] ,
571+ version : "1.0.0" ,
572+ specVersion : "1.0" ,
573+ type : "library" ,
574+ metadata : { name : "library.a" }
575+ } ,
576+ // B
577+ {
578+ id : "library.b" ,
579+ path : libraryBPath ,
580+ dependencies : [
581+ {
582+ // C - invalid - should be missing in preprocessed tree
583+ id : "module.c" ,
584+ dependencies : [ ] ,
585+ path : pathToInvalidModule ,
586+ version : "1.0.0"
587+ } ,
588+ {
589+ // D - invalid - should be missing in preprocessed tree
590+ id : "module.d" ,
591+ dependencies : [ ] ,
592+ path : pathToInvalidModule ,
593+ version : "1.0.0"
594+ }
595+ ] ,
596+ version : "1.0.0" ,
597+ specVersion : "1.0" ,
598+ type : "library" ,
599+ metadata : { name : "library.b" }
600+ }
601+ ] ,
602+ version : "1.0.0" ,
603+ specVersion : "1.0" ,
604+ type : "application" ,
605+ metadata : {
606+ name : "application.a"
607+ }
608+ } ;
609+
610+ const expectedTreeWithInvalidModules = {
611+ "id" : "application.a" ,
612+ "path" : applicationAPath ,
613+ "dependencies" : [ {
614+ "id" : "library.a" ,
615+ "path" : libraryAPath ,
616+ "dependencies" : [ ] ,
617+ "version" : "1.0.0" ,
618+ "specVersion" : "1.0" ,
619+ "type" : "library" ,
620+ "metadata" : {
621+ "name" : "library.a" ,
622+ "copyright" : "Some fancy copyright ${currentYear}"
623+ } ,
624+ "kind" : "project" ,
625+ "_level" : 1 ,
626+ "resources" : {
627+ "configuration" : {
628+ "paths" : {
629+ "src" : "src" ,
630+ "test" : "test"
631+ }
632+ } ,
633+ "pathMappings" : {
634+ "/resources/" : "src" ,
635+ "/test-resources/" : "test"
636+ }
637+ }
638+ } , {
639+ "id" : "library.b" ,
640+ "path" : libraryBPath ,
641+ "dependencies" : [ ] ,
642+ "version" : "1.0.0" ,
643+ "specVersion" : "1.0" ,
644+ "type" : "library" ,
645+ "metadata" : {
646+ "name" : "library.b" ,
647+ "copyright" : "Some fancy copyright ${currentYear}"
648+ } ,
649+ "kind" : "project" ,
650+ "_level" : 1 ,
651+ "resources" : {
652+ "configuration" : {
653+ "paths" : {
654+ "src" : "src" ,
655+ "test" : "test"
656+ }
657+ } ,
658+ "pathMappings" : {
659+ "/resources/" : "src" ,
660+ "/test-resources/" : "test"
661+ }
662+ }
663+ } ] ,
664+ "version" : "1.0.0" ,
665+ "specVersion" : "1.0" ,
666+ "type" : "application" ,
667+ "metadata" : {
668+ "name" : "application.a"
669+ } ,
670+ "_level" : 0 ,
671+ "kind" : "project" ,
672+ "resources" : {
673+ "configuration" : {
674+ "paths" : {
675+ "webapp" : "webapp"
676+ }
677+ } ,
678+ "pathMappings" : {
679+ "/" : "webapp"
680+ }
681+ }
682+ } ;
683+
539684/* === Tree A === */
540685const treeAWithInlineConfigs = {
541686 id : "application.a" ,
0 commit comments