@@ -28,6 +28,7 @@ describe("runs", () => {
2828 } ) ;
2929 getErrorCodeFromErrStub = sandbox . stub ( ) . returns ( "random-error-code" ) ;
3030 deleteResultsStub = sandbox . stub ( ) ;
31+ readBsConfigJSONStub = sandbox . stub ( ) . returns ( null ) ;
3132 } ) ;
3233
3334 afterEach ( ( ) => {
@@ -47,7 +48,8 @@ describe("runs", () => {
4748 sendUsageReport : sendUsageReportStub ,
4849 setUsageReportingFlag : setUsageReportingFlagStub ,
4950 getConfigPath : getConfigPathStub ,
50- deleteResults : deleteResultsStub
51+ deleteResults : deleteResultsStub ,
52+ readBsConfigJSON : readBsConfigJSONStub
5153 } ,
5254 } ) ;
5355
@@ -206,6 +208,7 @@ describe("runs", () => {
206208
207209 beforeEach ( ( ) => {
208210 sandbox = sinon . createSandbox ( ) ;
211+ getParallelsStub = sandbox . stub ( ) ;
209212 setParallelsStub = sandbox . stub ( ) ;
210213 warnSpecLimitStub = sandbox . stub ( ) ;
211214 setUsernameStub = sandbox . stub ( ) ;
@@ -257,6 +260,7 @@ describe("runs", () => {
257260 '../helpers/utils' : {
258261 validateBstackJson : validateBstackJsonStub ,
259262 sendUsageReport : sendUsageReportStub ,
263+ getParallels : getParallelsStub ,
260264 setParallels : setParallelsStub ,
261265 warnSpecLimit : warnSpecLimitStub ,
262266 setUsername : setUsernameStub ,
@@ -322,6 +326,7 @@ describe("runs", () => {
322326 sinon . assert . calledOnce ( setLocalConfigFileStub ) ;
323327 sinon . assert . calledOnce ( setCypressConfigFilenameStub ) ;
324328 sinon . assert . calledOnce ( getNumberOfSpecFilesStub ) ;
329+ sinon . assert . calledOnce ( getParallelsStub ) ;
325330 sinon . assert . calledOnce ( setParallelsStub ) ;
326331 sinon . assert . calledOnce ( warnSpecLimitStub ) ;
327332 sinon . assert . calledOnce ( setLocalStub ) ;
@@ -356,6 +361,7 @@ describe("runs", () => {
356361 beforeEach ( ( ) => {
357362 sandbox = sinon . createSandbox ( ) ;
358363 validateBstackJsonStub = sandbox . stub ( ) ;
364+ getParallelsStub = sandbox . stub ( ) ;
359365 setParallelsStub = sandbox . stub ( ) ;
360366 warnSpecLimitStub = sandbox . stub ( ) ;
361367 setUsernameStub = sandbox . stub ( ) ;
@@ -408,6 +414,7 @@ describe("runs", () => {
408414 '../helpers/utils' : {
409415 validateBstackJson : validateBstackJsonStub ,
410416 sendUsageReport : sendUsageReportStub ,
417+ getParallels : getParallelsStub ,
411418 setParallels : setParallelsStub ,
412419 warnSpecLimit : warnSpecLimitStub ,
413420 setUsername : setUsernameStub ,
@@ -476,6 +483,7 @@ describe("runs", () => {
476483 sinon . assert . calledOnce ( setLocalModeStub ) ;
477484 sinon . assert . calledOnce ( setLocalConfigFileStub ) ;
478485 sinon . assert . calledOnce ( getNumberOfSpecFilesStub ) ;
486+ sinon . assert . calledOnce ( getParallelsStub ) ;
479487 sinon . assert . calledOnce ( setParallelsStub ) ;
480488 sinon . assert . calledOnce ( warnSpecLimitStub ) ;
481489 sinon . assert . calledOnce ( setLocalStub ) ;
@@ -513,6 +521,7 @@ describe("runs", () => {
513521 beforeEach ( ( ) => {
514522 sandbox = sinon . createSandbox ( ) ;
515523 validateBstackJsonStub = sandbox . stub ( ) ;
524+ getParallelsStub = sandbox . stub ( ) ;
516525 setParallelsStub = sandbox . stub ( ) ;
517526 warnSpecLimitStub = sandbox . stub ( ) ;
518527 setUsernameStub = sandbox . stub ( ) ;
@@ -567,6 +576,7 @@ describe("runs", () => {
567576 '../helpers/utils' : {
568577 validateBstackJson : validateBstackJsonStub ,
569578 sendUsageReport : sendUsageReportStub ,
579+ getParallels : getParallelsStub ,
570580 setParallels : setParallelsStub ,
571581 warnSpecLimit : warnSpecLimitStub ,
572582 setUsername : setUsernameStub ,
@@ -646,6 +656,7 @@ describe("runs", () => {
646656 sinon . assert . calledOnce ( validateBstackJsonStub ) ;
647657 sinon . assert . calledOnce ( capabilityValidatorStub ) ;
648658 sinon . assert . calledOnce ( getNumberOfSpecFilesStub ) ;
659+ sinon . assert . calledOnce ( getParallelsStub ) ;
649660 sinon . assert . calledOnce ( setParallelsStub ) ;
650661 sinon . assert . calledOnce ( warnSpecLimitStub ) ;
651662 sinon . assert . calledOnce ( setLocalStub ) ;
@@ -683,6 +694,7 @@ describe("runs", () => {
683694 beforeEach ( ( ) => {
684695 sandbox = sinon . createSandbox ( ) ;
685696 validateBstackJsonStub = sandbox . stub ( ) ;
697+ getParallelsStub = sandbox . stub ( ) ;
686698 setParallelsStub = sandbox . stub ( ) ;
687699 warnSpecLimitStub = sandbox . stub ( )
688700 setUsernameStub = sandbox . stub ( ) ;
@@ -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 = { 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 }
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' : {
@@ -762,6 +774,7 @@ describe("runs", () => {
762774 setTestEnvs : setTestEnvsStub ,
763775 setSystemEnvs : setSystemEnvsStub ,
764776 setUsageReportingFlag : setUsageReportingFlagStub ,
777+ getParallels : getParallelsStub ,
765778 setParallels : setParallelsStub ,
766779 warnSpecLimit : warnSpecLimitStub ,
767780 getConfigPath : getConfigPathStub ,
@@ -837,8 +850,9 @@ describe("runs", () => {
837850 stopLocalBinaryStub . returns ( Promise . resolve ( "nothing" ) ) ;
838851 nonEmptyArrayStub . returns ( false ) ;
839852 checkErrorStub . returns ( 'test' ) ;
853+ getParallelsStub . returns ( 10 ) ;
854+ createBuildStub . returns ( Promise . resolve ( { message : 'Success' , build_id : 'random_build_id' , dashboard_url : dashboardUrl , user_id : 1234 } ) ) ;
840855 fetchZipSizeStub . returns ( 123 ) ;
841- createBuildStub . returns ( Promise . resolve ( { message : 'Success' , build_id : 'random_build_id' , dashboard_url : dashboardUrl } ) ) ;
842856
843857 return runs ( args )
844858 . then ( function ( _bsConfig ) {
@@ -851,6 +865,7 @@ describe("runs", () => {
851865 sinon . assert . calledOnce ( setLocalConfigFileStub ) ;
852866 sinon . assert . calledOnce ( capabilityValidatorStub ) ;
853867 sinon . assert . calledOnce ( getNumberOfSpecFilesStub ) ;
868+ sinon . assert . calledOnce ( getParallelsStub ) ;
854869 sinon . assert . calledOnce ( setParallelsStub ) ;
855870 sinon . assert . calledOnce ( warnSpecLimitStub ) ;
856871 sinon . assert . calledTwice ( fetchZipSizeStub ) ;
0 commit comments