@@ -218,14 +218,34 @@ describe('Scope', function() {
218218 } ) ;
219219
220220
221- it ( 'should prevent infinite recursion' , function ( ) {
222- root . $watch ( 'a' , function ( self , v ) { self . b ++ ; } ) ;
223- root . $watch ( 'b' , function ( self , v ) { self . a ++ ; } ) ;
221+ it ( 'should prevent infinite recursion and print watcher expression ' , function ( ) {
222+ root . $watch ( 'a' , function ( self ) { self . b ++ ; } ) ;
223+ root . $watch ( 'b' , function ( self ) { self . a ++ ; } ) ;
224224 root . a = root . b = 0 ;
225225
226226 expect ( function ( ) {
227227 root . $digest ( ) ;
228- } ) . toThrow ( '100 $digest() iterations reached. Aborting!' ) ;
228+ } ) . toThrow ( '100 $digest() iterations reached. Aborting!\n' +
229+ 'Watchers fired in the last 5 iterations: ' +
230+ '[["a","b"],["a","b"],["a","b"],["a","b"],["a","b"]]' ) ;
231+ } ) ;
232+
233+
234+ it ( 'should prevent infinite recurcion and print print watcher function name or body' ,
235+ function ( ) {
236+ root . $watch ( function watcherA ( ) { return root . a ; } , function ( self ) { self . b ++ ; } ) ;
237+ root . $watch ( function ( ) { return root . b ; } , function ( self ) { self . a ++ ; } ) ;
238+ root . a = root . b = 0 ;
239+
240+ expect ( function ( ) {
241+ root . $digest ( ) ;
242+ } ) . toThrow ( '100 $digest() iterations reached. Aborting!\n' +
243+ 'Watchers fired in the last 5 iterations: ' +
244+ '[["fn: watcherA","fn: function () {return root.b;}"],' +
245+ '["fn: watcherA","fn: function () {return root.b;}"],' +
246+ '["fn: watcherA","fn: function () {return root.b;}"],' +
247+ '["fn: watcherA","fn: function () {return root.b;}"],' +
248+ '["fn: watcherA","fn: function () {return root.b;}"]]' ) ;
229249 } ) ;
230250
231251
0 commit comments