@@ -7,6 +7,7 @@ const applicationC2Path = path.join(__dirname, "..", "..", "fixtures", "applicat
77const applicationC3Path = path . join ( __dirname , ".." , ".." , "fixtures" , "application.c3" ) ;
88const applicationDPath = path . join ( __dirname , ".." , ".." , "fixtures" , "application.d" ) ;
99const applicationFPath = path . join ( __dirname , ".." , ".." , "fixtures" , "application.f" ) ;
10+ const applicationGPath = path . join ( __dirname , ".." , ".." , "fixtures" , "application.g" ) ;
1011const errApplicationAPath = path . join ( __dirname , ".." , ".." , "fixtures" , "err.application.a" ) ;
1112
1213test ( "AppA: project with collection dependency" , ( t ) => {
@@ -48,6 +49,12 @@ test("AppF: project with UI5-dependencies", (t) => {
4849 } ) ;
4950} ) ;
5051
52+ test ( "AppG: project with npm 'optionalDependencies' should not fail if optional dependency cannot be resolved" , ( t ) => {
53+ return npmTranslator . generateDependencyTree ( applicationGPath ) . then ( ( parsedTree ) => {
54+ t . deepEqual ( parsedTree , applicationGTree , "Parsed correctly" ) ;
55+ } ) ;
56+ } ) ;
57+
5158test ( "Error: missing package.json" , async ( t ) => {
5259 const dir = path . parse ( __dirname ) . root ;
5360 const error = await t . throws ( npmTranslator . generateDependencyTree ( dir ) ) ;
@@ -226,3 +233,10 @@ const applicationFTree = {
226233 }
227234 ]
228235} ;
236+
237+ const applicationGTree = {
238+ id : "application.g" ,
239+ version : "1.0.0" ,
240+ path : applicationGPath ,
241+ dependencies : [ ]
242+ } ;
0 commit comments