@@ -54,7 +54,8 @@ var basicValidExtension = path.join(testFilesDirectory, "basic-valid-exten
5454 missingPackageJSON = path . join ( testFilesDirectory , "missing-package-json.zip" ) ,
5555 missingPackageJSONUpdate = path . join ( testFilesDirectory , "missing-package-json-update.zip" ) ,
5656 missingPackageJSONRenamed = path . join ( testFilesDirectory , "added-package-json-test" , "missing-package-json.zip" ) ,
57- withSymlink = path . join ( testFilesDirectory , "with-symlink.zip" ) ;
57+ withSymlink = path . join ( testFilesDirectory , "with-symlink.zip" ) ,
58+ withNpmDependencies = path . join ( testFilesDirectory , "with-npm-dependencies.zip" ) ;
5859
5960
6061describe ( "Package Installation" , function ( ) {
@@ -323,4 +324,30 @@ describe("Package Installation", function () {
323324 done ( ) ;
324325 } ) ;
325326 } ) ;
327+
328+ it ( "should download npm dependencies when present" , function ( done ) {
329+ ExtensionsDomain . _cmdInstall ( withNpmDependencies , installDirectory , standardOptions , function ( err , result ) {
330+ expect ( err ) . toBeNull ( ) ;
331+ expect ( result . errors . length ) . toEqual ( 0 ) ;
332+ expect ( fs . existsSync ( result . installedTo ) ) . toBe ( true ) ;
333+ expect ( fs . existsSync ( path . join ( result . installedTo , "node_modules" ) ) ) . toBe ( true ) ;
334+
335+ expect ( fs . existsSync ( path . join ( result . installedTo , "node_modules" , "lodash" ) ) ) . toBe ( true ) ;
336+ expect ( fs . existsSync ( path . join ( result . installedTo , "node_modules" , "lodash" , "package.json" ) ) ) . toBe ( true ) ;
337+ var packageInfo = JSON . parse ( fs . readFileSync ( path . join ( result . installedTo , "node_modules" , "lodash" , "package.json" ) ) ) ;
338+ expect ( packageInfo . version . slice ( 0 , 2 ) ) . toBe ( "3." ) ;
339+
340+ expect ( fs . existsSync ( path . join ( result . installedTo , "node_modules" , "moment" ) ) ) . toBe ( true ) ;
341+ expect ( fs . existsSync ( path . join ( result . installedTo , "node_modules" , "moment" , "package.json" ) ) ) . toBe ( true ) ;
342+ packageInfo = JSON . parse ( fs . readFileSync ( path . join ( result . installedTo , "node_modules" , "moment" , "package.json" ) ) ) ;
343+ expect ( packageInfo . version . slice ( 0 , 4 ) ) . toBe ( "2.5." ) ;
344+
345+ expect ( fs . existsSync ( path . join ( result . installedTo , "node_modules" , "underscore" ) ) ) . toBe ( true ) ;
346+ expect ( fs . existsSync ( path . join ( result . installedTo , "node_modules" , "underscore" , "package.json" ) ) ) . toBe ( true ) ;
347+ packageInfo = JSON . parse ( fs . readFileSync ( path . join ( result . installedTo , "node_modules" , "underscore" , "package.json" ) ) ) ;
348+ expect ( packageInfo . version ) . toBe ( "1.0.4" ) ;
349+
350+ done ( ) ;
351+ } ) ;
352+ } ) ;
326353} ) ;
0 commit comments