@@ -397,6 +397,7 @@ describe("runs", () => {
397397 setConfigStub = sandbox . stub ( ) ;
398398 setBrowsersStub = sandbox . stub ( ) ;
399399 setCLIModeStub = sandbox . stub ( ) ;
400+ fetchZipSizeStub = sandbox . stub ( ) ;
400401 } ) ;
401402
402403 afterEach ( ( ) => {
@@ -438,7 +439,8 @@ describe("runs", () => {
438439 setLocalConfigFile : setLocalConfigFileStub ,
439440 setBrowsers : setBrowsersStub ,
440441 setConfig : setConfigStub ,
441- setCLIMode : setCLIModeStub
442+ setCLIMode : setCLIModeStub ,
443+ fetchZipSize : fetchZipSizeStub ,
442444 } ,
443445 '../helpers/capabilityHelper' : {
444446 validate : capabilityValidatorStub ,
@@ -468,6 +470,7 @@ describe("runs", () => {
468470 packageInstallerStub . returns ( Promise . resolve ( { packageArchieveCreated : false } ) ) ;
469471 archiverStub . returns ( Promise . resolve ( "Zipping completed" ) ) ;
470472 zipUploadStub . returns ( Promise . reject ( "random-error" ) ) ;
473+ fetchZipSizeStub . returns ( 123 ) ;
471474
472475 return runs ( args )
473476 . then ( function ( _bsConfig ) {
@@ -476,6 +479,7 @@ describe("runs", () => {
476479 . catch ( ( error ) => {
477480 sinon . assert . calledOnce ( getConfigPathStub ) ;
478481 sinon . assert . calledOnce ( getConfigPathStub ) ;
482+ sinon . assert . calledTwice ( fetchZipSizeStub ) ;
479483 sinon . assert . calledOnce ( setLocalModeStub ) ;
480484 sinon . assert . calledOnce ( setLocalConfigFileStub ) ;
481485 sinon . assert . calledOnce ( getNumberOfSpecFilesStub ) ;
@@ -555,6 +559,7 @@ describe("runs", () => {
555559 setConfigStub = sandbox . stub ( ) ;
556560 setBrowsersStub = sandbox . stub ( ) ;
557561 setCLIModeStub = sandbox . stub ( ) ;
562+ fetchZipSizeStub = sandbox . stub ( ) ;
558563 } ) ;
559564
560565 afterEach ( ( ) => {
@@ -597,7 +602,8 @@ describe("runs", () => {
597602 setLocalConfigFile : setLocalConfigFileStub ,
598603 setBrowsers : setBrowsersStub ,
599604 setConfig : setConfigStub ,
600- setCLIMode : setCLIModeStub
605+ setCLIMode : setCLIModeStub ,
606+ fetchZipSize : fetchZipSizeStub ,
601607 } ,
602608 '../helpers/capabilityHelper' : {
603609 validate : capabilityValidatorStub ,
@@ -634,6 +640,7 @@ describe("runs", () => {
634640 zipUploadStub . returns ( Promise . resolve ( "zip uploaded" ) ) ;
635641 stopLocalBinaryStub . returns ( Promise . resolve ( "nothing" ) ) ;
636642 createBuildStub . returns ( Promise . reject ( "random-error" ) ) ;
643+ fetchZipSizeStub . returns ( 123 ) ;
637644
638645 return runs ( args )
639646 . then ( function ( _bsConfig ) {
@@ -642,6 +649,7 @@ describe("runs", () => {
642649 . catch ( ( error ) => {
643650 sinon . assert . calledOnce ( getConfigPathStub ) ;
644651 sinon . assert . calledOnce ( getConfigPathStub ) ;
652+ sinon . assert . calledTwice ( fetchZipSizeStub ) ;
645653 sinon . assert . calledOnce ( setLocalConfigFileStub ) ;
646654 sinon . assert . calledOnce ( setLocalModeStub ) ;
647655 sinon . assert . calledOnce ( setupLocalTestingStub ) ;
@@ -706,6 +714,9 @@ describe("runs", () => {
706714 return "end" ;
707715 } ) ;
708716 dashboardUrl = "dashboard-url" ;
717+ packageDirName = "package-dir" ;
718+ packageFileName = "package-file" ;
719+ fileName = "file-name" ;
709720 capabilityValidatorStub = sandbox . stub ( ) ;
710721 archiverStub = sandbox . stub ( ) ;
711722 zipUploadStub = sandbox . stub ( ) ;
@@ -736,6 +747,7 @@ describe("runs", () => {
736747 nonEmptyArrayStub = sandbox . stub ( ) ;
737748 setCLIModeStub = sandbox . stub ( ) ;
738749 setProcessHooksStub = sandbox . stub ( ) ;
750+ fetchZipSizeStub = sandbox . stub ( ) ;
739751 } ) ;
740752
741753 afterEach ( ( ) => {
@@ -748,7 +760,7 @@ describe("runs", () => {
748760 let errorCode = null ;
749761 let message = `Success! ${ Constants . userMessages . BUILD_CREATED } with build id: random_build_id` ;
750762 let dashboardLink = `${ Constants . userMessages . VISIT_DASHBOARD } ${ dashboardUrl } ` ;
751- let data = { user_id : 1234 , parallels : 10 , time_components : { } , unique_id : 'random_hash' , package_error : 'test' , checkmd5_error : 'test' , build_id : 'random_build_id' }
763+ let data = { user_id : 1234 , parallels : 10 , time_components : { } , unique_id : 'random_hash' , package_error : 'test' , checkmd5_error : 'test' , build_id : 'random_build_id' , test_zip_size : 123 , npm_zip_size : 123 }
752764
753765 const runs = proxyquire ( '../../../../bin/commands/runs' , {
754766 '../helpers/utils' : {
@@ -786,7 +798,8 @@ describe("runs", () => {
786798 nonEmptyArray : nonEmptyArrayStub ,
787799 checkError : checkErrorStub ,
788800 setCLIMode : setCLIModeStub ,
789- setProcessHooks : setProcessHooksStub
801+ setProcessHooks : setProcessHooksStub ,
802+ fetchZipSize : fetchZipSizeStub ,
790803 } ,
791804 '../helpers/capabilityHelper' : {
792805 validate : capabilityValidatorStub ,
@@ -806,6 +819,9 @@ describe("runs", () => {
806819 } ,
807820 '../helpers/config' : {
808821 dashboardUrl : dashboardUrl ,
822+ packageDirName : packageDirName ,
823+ packageFileName : packageFileName ,
824+ fileName : fileName ,
809825 } ,
810826 '../helpers/checkUploaded' : {
811827 checkUploadedMd5 : checkUploadedStub ,
@@ -836,6 +852,7 @@ describe("runs", () => {
836852 checkErrorStub . returns ( 'test' ) ;
837853 getParallelsStub . returns ( 10 ) ;
838854 createBuildStub . returns ( Promise . resolve ( { message : 'Success' , build_id : 'random_build_id' , dashboard_url : dashboardUrl , user_id : 1234 } ) ) ;
855+ fetchZipSizeStub . returns ( 123 ) ;
839856
840857 return runs ( args )
841858 . then ( function ( _bsConfig ) {
@@ -851,6 +868,7 @@ describe("runs", () => {
851868 sinon . assert . calledOnce ( getParallelsStub ) ;
852869 sinon . assert . calledOnce ( setParallelsStub ) ;
853870 sinon . assert . calledOnce ( warnSpecLimitStub ) ;
871+ sinon . assert . calledTwice ( fetchZipSizeStub ) ;
854872 sinon . assert . calledOnce ( setLocalStub ) ;
855873 sinon . assert . calledOnce ( setLocalModeStub ) ;
856874 sinon . assert . calledOnce ( setupLocalTestingStub ) ;
0 commit comments