@@ -436,6 +436,40 @@ describe("BundlePusher01", () => {
436
436
expect ( readSpy ) . toHaveBeenCalledTimes ( 1 ) ;
437
437
expect ( uploadSpy ) . toHaveBeenCalledTimes ( 1 ) ;
438
438
} ) ;
439
+ it ( "should handle failure of remote npm install with FSUM message" , async ( ) => {
440
+ shellSpy . mockImplementation ( ( session : any , cmd : string , dir : string , stdoutHandler : ( data : string ) => void ) => {
441
+ if ( cmd . indexOf ( "npm install" ) > - 1 ) {
442
+ stdoutHandler ( "Injected FSUM7351 not found message" ) ;
443
+ }
444
+ else {
445
+ return true ;
446
+ }
447
+ } ) ;
448
+ existsSpy . mockImplementation ( ( data : string ) => {
449
+ if ( data . indexOf ( ".zosattributes" ) > - 1 ) {
450
+ return false ;
451
+ }
452
+ if ( data . indexOf ( "package.json" ) > - 1 ) {
453
+ return true ;
454
+ }
455
+ } ) ;
456
+
457
+ await runPushTestWithError ( "__tests__/__resources__/ExampleBundle01" , false ,
458
+ "A problem occurred attempting to run 'npm install' in remote directory '/u/ThisDoesNotExist/12345678'. " +
459
+ "Problem is: The output from the remote command implied that an error occurred." ) ;
460
+
461
+ expect ( consoleText ) . toContain ( "Injected FSUM7351 not found message" ) ;
462
+ expect ( zosMFSpy ) . toHaveBeenCalledTimes ( 1 ) ;
463
+ expect ( sshSpy ) . toHaveBeenCalledTimes ( 1 ) ;
464
+ expect ( createSpy ) . toHaveBeenCalledTimes ( 1 ) ;
465
+ expect ( listSpy ) . toHaveBeenCalledTimes ( 1 ) ;
466
+ expect ( shellSpy ) . toHaveBeenCalledTimes ( 1 ) ;
467
+ expect ( membersSpy ) . toHaveBeenCalledTimes ( 0 ) ;
468
+ expect ( submitSpy ) . toHaveBeenCalledTimes ( 0 ) ;
469
+ expect ( existsSpy ) . toHaveBeenCalledTimes ( 2 ) ;
470
+ expect ( readSpy ) . toHaveBeenCalledTimes ( 1 ) ;
471
+ expect ( uploadSpy ) . toHaveBeenCalledTimes ( 1 ) ;
472
+ } ) ;
439
473
it ( "should handle error with remote bundle deploy" , async ( ) => {
440
474
submitSpy . mockImplementationOnce ( ( ) => { throw new Error ( "Injected deploy error" ) ; } ) ;
441
475
0 commit comments