@@ -391,6 +391,7 @@ describe("runs", () => {
391391 setConfigStub = sandbox . stub ( ) ;
392392 setBrowsersStub = sandbox . stub ( ) ;
393393 setCLIModeStub = sandbox . stub ( ) ;
394+ fetchZipSizeStub = sandbox . stub ( ) ;
394395 } ) ;
395396
396397 afterEach ( ( ) => {
@@ -431,7 +432,8 @@ describe("runs", () => {
431432 setLocalConfigFile : setLocalConfigFileStub ,
432433 setBrowsers : setBrowsersStub ,
433434 setConfig : setConfigStub ,
434- setCLIMode : setCLIModeStub
435+ setCLIMode : setCLIModeStub ,
436+ fetchZipSize : fetchZipSizeStub ,
435437 } ,
436438 '../helpers/capabilityHelper' : {
437439 validate : capabilityValidatorStub ,
@@ -461,6 +463,7 @@ describe("runs", () => {
461463 packageInstallerStub . returns ( Promise . resolve ( { packageArchieveCreated : false } ) ) ;
462464 archiverStub . returns ( Promise . resolve ( "Zipping completed" ) ) ;
463465 zipUploadStub . returns ( Promise . reject ( "random-error" ) ) ;
466+ fetchZipSizeStub . returns ( 123 ) ;
464467
465468 return runs ( args )
466469 . then ( function ( _bsConfig ) {
@@ -469,6 +472,7 @@ describe("runs", () => {
469472 . catch ( ( error ) => {
470473 sinon . assert . calledOnce ( getConfigPathStub ) ;
471474 sinon . assert . calledOnce ( getConfigPathStub ) ;
475+ sinon . assert . calledTwice ( fetchZipSizeStub ) ;
472476 sinon . assert . calledOnce ( setLocalModeStub ) ;
473477 sinon . assert . calledOnce ( setLocalConfigFileStub ) ;
474478 sinon . assert . calledOnce ( getNumberOfSpecFilesStub ) ;
@@ -546,6 +550,7 @@ describe("runs", () => {
546550 setConfigStub = sandbox . stub ( ) ;
547551 setBrowsersStub = sandbox . stub ( ) ;
548552 setCLIModeStub = sandbox . stub ( ) ;
553+ fetchZipSizeStub = sandbox . stub ( ) ;
549554 } ) ;
550555
551556 afterEach ( ( ) => {
@@ -587,7 +592,8 @@ describe("runs", () => {
587592 setLocalConfigFile : setLocalConfigFileStub ,
588593 setBrowsers : setBrowsersStub ,
589594 setConfig : setConfigStub ,
590- setCLIMode : setCLIModeStub
595+ setCLIMode : setCLIModeStub ,
596+ fetchZipSize : fetchZipSizeStub ,
591597 } ,
592598 '../helpers/capabilityHelper' : {
593599 validate : capabilityValidatorStub ,
@@ -624,6 +630,7 @@ describe("runs", () => {
624630 zipUploadStub . returns ( Promise . resolve ( "zip uploaded" ) ) ;
625631 stopLocalBinaryStub . returns ( Promise . resolve ( "nothing" ) ) ;
626632 createBuildStub . returns ( Promise . reject ( "random-error" ) ) ;
633+ fetchZipSizeStub . returns ( 123 ) ;
627634
628635 return runs ( args )
629636 . then ( function ( _bsConfig ) {
@@ -632,6 +639,7 @@ describe("runs", () => {
632639 . catch ( ( error ) => {
633640 sinon . assert . calledOnce ( getConfigPathStub ) ;
634641 sinon . assert . calledOnce ( getConfigPathStub ) ;
642+ sinon . assert . calledTwice ( fetchZipSizeStub ) ;
635643 sinon . assert . calledOnce ( setLocalConfigFileStub ) ;
636644 sinon . assert . calledOnce ( setLocalModeStub ) ;
637645 sinon . assert . calledOnce ( setupLocalTestingStub ) ;
@@ -694,6 +702,9 @@ describe("runs", () => {
694702 return "end" ;
695703 } ) ;
696704 dashboardUrl = "dashboard-url" ;
705+ packageDirName = "package-dir" ;
706+ packageFileName = "package-file" ;
707+ fileName = "file-name" ;
697708 capabilityValidatorStub = sandbox . stub ( ) ;
698709 archiverStub = sandbox . stub ( ) ;
699710 zipUploadStub = sandbox . stub ( ) ;
@@ -724,6 +735,7 @@ describe("runs", () => {
724735 nonEmptyArrayStub = sandbox . stub ( ) ;
725736 setCLIModeStub = sandbox . stub ( ) ;
726737 setProcessHooksStub = sandbox . stub ( ) ;
738+ fetchZipSizeStub = sandbox . stub ( ) ;
727739 } ) ;
728740
729741 afterEach ( ( ) => {
@@ -736,7 +748,7 @@ describe("runs", () => {
736748 let errorCode = null ;
737749 let message = `Success! ${ Constants . userMessages . BUILD_CREATED } with build id: random_build_id` ;
738750 let dashboardLink = `${ Constants . userMessages . VISIT_DASHBOARD } ${ dashboardUrl } ` ;
739- let data = { time_components : { } , unique_id : 'random_hash' , package_error : 'test' , checkmd5_error : 'test' , build_id : 'random_build_id' }
751+ let data = { 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 }
740752
741753 const runs = proxyquire ( '../../../../bin/commands/runs' , {
742754 '../helpers/utils' : {
@@ -773,7 +785,8 @@ describe("runs", () => {
773785 nonEmptyArray : nonEmptyArrayStub ,
774786 checkError : checkErrorStub ,
775787 setCLIMode : setCLIModeStub ,
776- setProcessHooks : setProcessHooksStub
788+ setProcessHooks : setProcessHooksStub ,
789+ fetchZipSize : fetchZipSizeStub ,
777790 } ,
778791 '../helpers/capabilityHelper' : {
779792 validate : capabilityValidatorStub ,
@@ -793,6 +806,9 @@ describe("runs", () => {
793806 } ,
794807 '../helpers/config' : {
795808 dashboardUrl : dashboardUrl ,
809+ packageDirName : packageDirName ,
810+ packageFileName : packageFileName ,
811+ fileName : fileName ,
796812 } ,
797813 '../helpers/checkUploaded' : {
798814 checkUploadedMd5 : checkUploadedStub ,
@@ -821,13 +837,15 @@ describe("runs", () => {
821837 stopLocalBinaryStub . returns ( Promise . resolve ( "nothing" ) ) ;
822838 nonEmptyArrayStub . returns ( false ) ;
823839 checkErrorStub . returns ( 'test' ) ;
840+ fetchZipSizeStub . returns ( 123 ) ;
824841 createBuildStub . returns ( Promise . resolve ( { message : 'Success' , build_id : 'random_build_id' , dashboard_url : dashboardUrl } ) ) ;
825842
826843 return runs ( args )
827844 . then ( function ( _bsConfig ) {
828845 chai . assert . fail ( "Promise error" ) ;
829846 } )
830847 . catch ( ( error ) => {
848+ console . log ( error ) ;
831849 sinon . assert . calledOnce ( getConfigPathStub ) ;
832850 sinon . assert . calledOnce ( getConfigPathStub ) ;
833851 sinon . assert . calledOnce ( validateBstackJsonStub ) ;
@@ -836,6 +854,7 @@ describe("runs", () => {
836854 sinon . assert . calledOnce ( getNumberOfSpecFilesStub ) ;
837855 sinon . assert . calledOnce ( setParallelsStub ) ;
838856 sinon . assert . calledOnce ( warnSpecLimitStub ) ;
857+ sinon . assert . calledTwice ( fetchZipSizeStub ) ;
839858 sinon . assert . calledOnce ( setLocalStub ) ;
840859 sinon . assert . calledOnce ( setLocalModeStub ) ;
841860 sinon . assert . calledOnce ( setupLocalTestingStub ) ;
0 commit comments