@@ -280,6 +280,22 @@ describe("BundlePusher01", () => {
280
280
expect ( membersSpy ) . toHaveBeenCalledTimes ( 2 ) ;
281
281
expect ( submitSpy ) . toHaveBeenCalledTimes ( 1 ) ;
282
282
} ) ;
283
+ it ( "should tolerate delete of empty directory" , async ( ) => {
284
+ shellSpy . mockImplementation ( ( session : any , cmd : string , dir : string , stdoutHandler : ( data : string ) => void ) => {
285
+ stdoutHandler ( "Injected FSUM9195 empty directory message" ) ;
286
+ } ) ;
287
+
288
+ await runPushTest ( "__tests__/__resources__/ExampleBundle01" , true ,
289
+ "PUSH operation completed." ) ;
290
+
291
+ expect ( zosMFSpy ) . toHaveBeenCalledTimes ( 1 ) ;
292
+ expect ( sshSpy ) . toHaveBeenCalledTimes ( 1 ) ;
293
+ expect ( createSpy ) . toHaveBeenCalledTimes ( 1 ) ;
294
+ expect ( listSpy ) . toHaveBeenCalledTimes ( 1 ) ;
295
+ expect ( shellSpy ) . toHaveBeenCalledTimes ( 1 ) ;
296
+ expect ( membersSpy ) . toHaveBeenCalledTimes ( 2 ) ;
297
+ expect ( submitSpy ) . toHaveBeenCalledTimes ( 2 ) ;
298
+ } ) ;
283
299
it ( "should handle error with attribs file" , async ( ) => {
284
300
existsSpy . mockImplementation ( ( data : string ) => {
285
301
if ( data . indexOf ( ".zosattributes" ) > - 1 ) {
@@ -421,7 +437,8 @@ describe("BundlePusher01", () => {
421
437
} ) ;
422
438
423
439
await runPushTestWithError ( "__tests__/__resources__/ExampleBundle01" , false ,
424
- "A problem occurred attempting to run 'npm install' in remote directory '/u/ThisDoesNotExist/12345678'. " +
440
+ "A problem occurred attempting to run 'export PATH=\"$PATH:/usr/lpp/IBM/cnj/IBM/node-latest-os390-s390x/bin\" " +
441
+ "&& npm install' in remote directory '/u/ThisDoesNotExist/12345678'. " +
425
442
"Problem is: The output from the remote command implied that an error occurred." ) ;
426
443
427
444
expect ( consoleText ) . toContain ( "Injected stdout error message" ) ;
@@ -455,7 +472,8 @@ describe("BundlePusher01", () => {
455
472
} ) ;
456
473
457
474
await runPushTestWithError ( "__tests__/__resources__/ExampleBundle01" , false ,
458
- "A problem occurred attempting to run 'npm install' in remote directory '/u/ThisDoesNotExist/12345678'. " +
475
+ "A problem occurred attempting to run 'export PATH=\"$PATH:/usr/lpp/IBM/cnj/IBM/node-latest-os390-s390x/bin\" " +
476
+ "&& npm install' in remote directory '/u/ThisDoesNotExist/12345678'. " +
459
477
"Problem is: The output from the remote command implied that an error occurred." ) ;
460
478
461
479
expect ( consoleText ) . toContain ( "Injected FSUM7351 not found message" ) ;
@@ -470,6 +488,41 @@ describe("BundlePusher01", () => {
470
488
expect ( readSpy ) . toHaveBeenCalledTimes ( 1 ) ;
471
489
expect ( uploadSpy ) . toHaveBeenCalledTimes ( 1 ) ;
472
490
} ) ;
491
+ it ( "should handle failure of remote npm install with node error" , async ( ) => {
492
+ shellSpy . mockImplementation ( ( session : any , cmd : string , dir : string , stdoutHandler : ( data : string ) => void ) => {
493
+ if ( cmd . indexOf ( "npm install" ) > - 1 ) {
494
+ stdoutHandler ( "Injected npm ERR! Exit status 1 message" ) ;
495
+ }
496
+ else {
497
+ return true ;
498
+ }
499
+ } ) ;
500
+ existsSpy . mockImplementation ( ( data : string ) => {
501
+ if ( data . indexOf ( ".zosattributes" ) > - 1 ) {
502
+ return false ;
503
+ }
504
+ if ( data . indexOf ( "package.json" ) > - 1 ) {
505
+ return true ;
506
+ }
507
+ } ) ;
508
+
509
+ await runPushTestWithError ( "__tests__/__resources__/ExampleBundle01" , false ,
510
+ "A problem occurred attempting to run 'export PATH=\"$PATH:/usr/lpp/IBM/cnj/IBM/node-latest-os390-s390x/bin\" " +
511
+ "&& npm install' in remote directory '/u/ThisDoesNotExist/12345678'. " +
512
+ "Problem is: The output from the remote command implied that an error occurred." ) ;
513
+
514
+ expect ( consoleText ) . toContain ( "Injected npm ERR! Exit status 1 message" ) ;
515
+ expect ( zosMFSpy ) . toHaveBeenCalledTimes ( 1 ) ;
516
+ expect ( sshSpy ) . toHaveBeenCalledTimes ( 1 ) ;
517
+ expect ( createSpy ) . toHaveBeenCalledTimes ( 1 ) ;
518
+ expect ( listSpy ) . toHaveBeenCalledTimes ( 1 ) ;
519
+ expect ( shellSpy ) . toHaveBeenCalledTimes ( 1 ) ;
520
+ expect ( membersSpy ) . toHaveBeenCalledTimes ( 0 ) ;
521
+ expect ( submitSpy ) . toHaveBeenCalledTimes ( 0 ) ;
522
+ expect ( existsSpy ) . toHaveBeenCalledTimes ( 2 ) ;
523
+ expect ( readSpy ) . toHaveBeenCalledTimes ( 1 ) ;
524
+ expect ( uploadSpy ) . toHaveBeenCalledTimes ( 1 ) ;
525
+ } ) ;
473
526
it ( "should handle error with remote bundle deploy" , async ( ) => {
474
527
submitSpy . mockImplementationOnce ( ( ) => { throw new Error ( "Injected deploy error" ) ; } ) ;
475
528
0 commit comments