@@ -297,7 +297,7 @@ describe("TreeProcessor", function() {
297
297
node . getResult . and . returnValue ( { my : 'result' } ) ;
298
298
299
299
queueRunner . calls . mostRecent ( ) . args [ 0 ] . onComplete ( ) ;
300
- expect ( nodeComplete ) . toHaveBeenCalledWith ( node , { my : 'result' } , nodeDone ) ;
300
+ expect ( nodeComplete ) . toHaveBeenCalledWith ( node , { my : 'result' } , jasmine . any ( Function ) ) ;
301
301
} ) ;
302
302
303
303
it ( "runs a node with children" , function ( ) {
@@ -328,6 +328,37 @@ describe("TreeProcessor", function() {
328
328
expect ( leaf2 . execute ) . toHaveBeenCalledWith ( 'bar' , false ) ;
329
329
} ) ;
330
330
331
+ it ( "cascades errors up the tree" , function ( ) {
332
+ var leaf = new Leaf ( ) ,
333
+ node = new Node ( { children : [ leaf ] } ) ,
334
+ root = new Node ( { children : [ node ] } ) ,
335
+ queueRunner = jasmine . createSpy ( 'queueRunner' ) ,
336
+ nodeComplete = jasmine . createSpy ( 'nodeComplete' ) ,
337
+ processor = new jasmineUnderTest . TreeProcessor ( {
338
+ tree : root ,
339
+ runnableIds : [ node . id ] ,
340
+ nodeComplete : nodeComplete ,
341
+ queueRunnerFactory : queueRunner
342
+ } ) ,
343
+ treeComplete = jasmine . createSpy ( 'treeComplete' ) ,
344
+ nodeDone = jasmine . createSpy ( 'nodeDone' ) ;
345
+
346
+ processor . execute ( treeComplete ) ;
347
+ var queueableFns = queueRunner . calls . mostRecent ( ) . args [ 0 ] . queueableFns ;
348
+ queueableFns [ 0 ] . fn ( nodeDone ) ;
349
+
350
+ queueableFns = queueRunner . calls . mostRecent ( ) . args [ 0 ] . queueableFns ;
351
+ expect ( queueableFns . length ) . toBe ( 2 ) ;
352
+
353
+ queueableFns [ 1 ] . fn ( 'foo' ) ;
354
+ expect ( leaf . execute ) . toHaveBeenCalledWith ( 'foo' , false ) ;
355
+
356
+ queueRunner . calls . mostRecent ( ) . args [ 0 ] . onComplete ( 'things' ) ;
357
+ expect ( nodeComplete ) . toHaveBeenCalled ( ) ;
358
+ nodeComplete . calls . mostRecent ( ) . args [ 2 ] ( ) ;
359
+ expect ( nodeDone ) . toHaveBeenCalledWith ( 'things' ) ;
360
+ } ) ;
361
+
331
362
it ( "runs an excluded node with leaf" , function ( ) {
332
363
var leaf1 = new Leaf ( ) ,
333
364
node = new Node ( { children : [ leaf1 ] } ) ,
@@ -361,7 +392,7 @@ describe("TreeProcessor", function() {
361
392
node . getResult . and . returnValue ( { im : 'disabled' } ) ;
362
393
363
394
queueRunner . calls . mostRecent ( ) . args [ 0 ] . onComplete ( ) ;
364
- expect ( nodeComplete ) . toHaveBeenCalledWith ( node , { im : 'disabled' } , nodeDone ) ;
395
+ expect ( nodeComplete ) . toHaveBeenCalledWith ( node , { im : 'disabled' } , jasmine . any ( Function ) ) ;
365
396
} ) ;
366
397
367
398
it ( "runs beforeAlls for a node with children" , function ( ) {
0 commit comments