@@ -8,6 +8,7 @@ const libraryAPath = path.join(__dirname, "..", "fixtures", "collection", "libra
88const libraryBPath = path . join ( __dirname , ".." , "fixtures" , "collection" , "library.b" ) ;
99// const libraryCPath = path.join(__dirname, "..", "fixtures", "collection", "library.c");
1010const libraryDPath = path . join ( __dirname , ".." , "fixtures" , "library.d" ) ;
11+ const cycleDepsBasePath = path . join ( __dirname , ".." , "fixtures" , "cyclic-deps" , "node_modules" ) ;
1112
1213test ( "Project with inline configuration" , ( t ) => {
1314 const tree = {
@@ -170,7 +171,7 @@ test("Missing id for root project", (t) => {
170171 dependencies : [ ]
171172 } ;
172173 return t . throws ( projectPreprocessor . processTree ( tree ) ,
173- "Encountered project with missing id" , "Rejected with error" ) ;
174+ "Encountered project with missing id (root project) " , "Rejected with error" ) ;
174175} ) ;
175176
176177test ( "No type configured for root project" , ( t ) => {
@@ -525,6 +526,13 @@ test("Project tree B with inline configs", (t) => {
525526 } ) ;
526527} ) ;
527528
529+ test ( "Project tree B with inline configs" , ( t ) => {
530+ // Tree B depends on Library B which has a dependency to Library D
531+ return projectPreprocessor . processTree ( treeApplicationCycleA ) . then ( ( parsedTree ) => {
532+ t . deepEqual ( parsedTree , expectedTreeApplicationCycleA , "Parsed correctly" ) ;
533+ } ) ;
534+ } ) ;
535+
528536/* ========================= */
529537/* ======= Test data ======= */
530538
@@ -1103,6 +1111,236 @@ const expectedTreeBWithInlineConfigs = {
11031111 ]
11041112} ;
11051113
1114+ const treeApplicationCycleA = {
1115+ id : "application.cycle.a" ,
1116+ version : "1.0.0" ,
1117+ specVersion : "0.1" ,
1118+ path : path . join ( cycleDepsBasePath , "application.cycle.a" ) ,
1119+ type : "application" ,
1120+ metadata : {
1121+ name : "application.cycle.a" ,
1122+ } ,
1123+ dependencies : [
1124+ {
1125+ id : "component.cycle.a" ,
1126+ version : "1.0.0" ,
1127+ specVersion : "0.1" ,
1128+ path : path . join ( cycleDepsBasePath , "component.cycle.a" ) ,
1129+ type : "library" ,
1130+ metadata : {
1131+ name : "component.cycle.a" ,
1132+ } ,
1133+ dependencies : [
1134+ {
1135+ id : "library.cycle.a" ,
1136+ version : "1.0.0" ,
1137+ specVersion : "0.1" ,
1138+ path : path . join ( cycleDepsBasePath , "library.cycle.a" ) ,
1139+ type : "library" ,
1140+ metadata : {
1141+ name : "library.cycle.a" ,
1142+ } ,
1143+ dependencies : [
1144+ {
1145+ id : "component.cycle.a" ,
1146+ version : "1.0.0" ,
1147+ specVersion : "0.1" ,
1148+ path : path . join ( cycleDepsBasePath , "component.cycle.a" ) ,
1149+ type : "library" ,
1150+ metadata : {
1151+ name : "component.cycle.a" ,
1152+ } ,
1153+ dependencies : [ ] ,
1154+ deduped : true
1155+ }
1156+ ]
1157+ } ,
1158+ {
1159+ id : "library.cycle.b" ,
1160+ version : "1.0.0" ,
1161+ specVersion : "0.1" ,
1162+ path : path . join ( cycleDepsBasePath , "library.cycle.b" ) ,
1163+ type : "library" ,
1164+ metadata : {
1165+ name : "library.cycle.b" ,
1166+ } ,
1167+ dependencies : [
1168+ {
1169+ id : "component.cycle.a" ,
1170+ version : "1.0.0" ,
1171+ specVersion : "0.1" ,
1172+ path : path . join ( cycleDepsBasePath , "component.cycle.a" ) ,
1173+ type : "library" ,
1174+ metadata : {
1175+ name : "component.cycle.a" ,
1176+ } ,
1177+ dependencies : [ ] ,
1178+ deduped : true
1179+ }
1180+ ]
1181+ } ,
1182+ {
1183+ id : "application.cycle.a" ,
1184+ version : "1.0.0" ,
1185+ specVersion : "0.1" ,
1186+ path : path . join ( cycleDepsBasePath , "application.cycle.a" ) ,
1187+ type : "application" ,
1188+ metadata : {
1189+ name : "application.cycle.a" ,
1190+ } ,
1191+ dependencies : [ ] ,
1192+ deduped : true
1193+ }
1194+ ]
1195+ }
1196+ ]
1197+ } ;
1198+
1199+ const expectedTreeApplicationCycleA = {
1200+ "id" : "application.cycle.a" ,
1201+ "version" : "1.0.0" ,
1202+ "specVersion" : "0.1" ,
1203+ "path" : path . join ( cycleDepsBasePath , "application.cycle.a" ) ,
1204+ "type" : "application" ,
1205+ "metadata" : {
1206+ "name" : "application.cycle.a"
1207+ } ,
1208+ "dependencies" : [
1209+ {
1210+ "id" : "component.cycle.a" ,
1211+ "version" : "1.0.0" ,
1212+ "specVersion" : "0.1" ,
1213+ "path" : path . join ( cycleDepsBasePath , "component.cycle.a" ) ,
1214+ "type" : "library" ,
1215+ "metadata" : {
1216+ "name" : "component.cycle.a" ,
1217+ "copyright" : "${copyright}"
1218+ } ,
1219+ "dependencies" : [
1220+ {
1221+ "id" : "library.cycle.a" ,
1222+ "version" : "1.0.0" ,
1223+ "specVersion" : "0.1" ,
1224+ "path" : path . join ( cycleDepsBasePath , "library.cycle.a" ) ,
1225+ "type" : "library" ,
1226+ "metadata" : {
1227+ "name" : "library.cycle.a" ,
1228+ "copyright" : "${copyright}"
1229+ } ,
1230+ "dependencies" : [
1231+ {
1232+ "id" : "component.cycle.a" ,
1233+ "version" : "1.0.0" ,
1234+ "specVersion" : "0.1" ,
1235+ "path" : path . join ( cycleDepsBasePath , "component.cycle.a" ) ,
1236+ "type" : "library" ,
1237+ "metadata" : {
1238+ "name" : "component.cycle.a"
1239+ } ,
1240+ "dependencies" : [ ] ,
1241+ "deduped" : true
1242+ }
1243+ ] ,
1244+ "kind" : "project" ,
1245+ "_level" : 2 ,
1246+ "resources" : {
1247+ "configuration" : {
1248+ "paths" : {
1249+ "src" : "src" ,
1250+ "test" : "test"
1251+ }
1252+ } ,
1253+ "pathMappings" : {
1254+ "/resources/" : "src" ,
1255+ "/test-resources/" : "test"
1256+ }
1257+ }
1258+ } ,
1259+ {
1260+ "id" : "library.cycle.b" ,
1261+ "version" : "1.0.0" ,
1262+ "specVersion" : "0.1" ,
1263+ "path" : path . join ( cycleDepsBasePath , "library.cycle.b" ) ,
1264+ "type" : "library" ,
1265+ "metadata" : {
1266+ "name" : "library.cycle.b" ,
1267+ "copyright" : "${copyright}"
1268+ } ,
1269+ "dependencies" : [
1270+ {
1271+ "id" : "component.cycle.a" ,
1272+ "version" : "1.0.0" ,
1273+ "specVersion" : "0.1" ,
1274+ "path" : path . join ( cycleDepsBasePath , "component.cycle.a" ) ,
1275+ "type" : "library" ,
1276+ "metadata" : {
1277+ "name" : "component.cycle.a"
1278+ } ,
1279+ "dependencies" : [ ] ,
1280+ "deduped" : true
1281+ }
1282+ ] ,
1283+ "kind" : "project" ,
1284+ "_level" : 2 ,
1285+ "resources" : {
1286+ "configuration" : {
1287+ "paths" : {
1288+ "src" : "src" ,
1289+ "test" : "test"
1290+ }
1291+ } ,
1292+ "pathMappings" : {
1293+ "/resources/" : "src" ,
1294+ "/test-resources/" : "test"
1295+ }
1296+ }
1297+ } ,
1298+ {
1299+ "id" : "application.cycle.a" ,
1300+ "version" : "1.0.0" ,
1301+ "specVersion" : "0.1" ,
1302+ "path" : path . join ( cycleDepsBasePath , "application.cycle.a" ) ,
1303+ "type" : "application" ,
1304+ "metadata" : {
1305+ "name" : "application.cycle.a"
1306+ } ,
1307+ "dependencies" : [ ] ,
1308+ "deduped" : true
1309+ }
1310+ ] ,
1311+ "kind" : "project" ,
1312+ "_level" : 1 ,
1313+ "resources" : {
1314+ "configuration" : {
1315+ "paths" : {
1316+ "src" : "src" ,
1317+ "test" : "test"
1318+ }
1319+ } ,
1320+ "pathMappings" : {
1321+ "/resources/" : "src" ,
1322+ "/test-resources/" : "test"
1323+ }
1324+ }
1325+ }
1326+ ] ,
1327+ "_level" : 0 ,
1328+ "kind" : "project" ,
1329+ "resources" : {
1330+ "configuration" : {
1331+ "paths" : {
1332+ "webapp" : "webapp"
1333+ }
1334+ } ,
1335+ "pathMappings" : {
1336+ "/" : "webapp"
1337+ }
1338+ }
1339+ } ;
1340+
1341+ /* ======= /Test data ======= */
1342+ /* ========================= */
1343+
11061344test ( "Application version in package.json data is missing" , ( t ) => {
11071345 const tree = {
11081346 id : "application.a" ,
0 commit comments