angularjs fires a recursive $timeout in karma test

Viewed 20

I got a component I'm testing which works fine in the browser, but in the test, there's seem to a recursive $timeout call, with consecutive increasing time of 250.

console.log(_$browser_.deferredFns)
// { [Object{id: 8, type: '$timeout', time: 600, fn: function() { ... }}]

_$timeout_.flush()

console.log(_$browser_.deferredFns)
// { [Object{id: 9, type: '$timeout', time: 850, fn: function() { ... }}]

console.log(_$browser_.deferredFns[0].fn.toString())
/* function() {
        try {
          deferred.resolve(fn.apply(null, args));
        } catch (e) {
          deferred.reject(e);
          $exceptionHandler(e);
        } finally {
          delete deferreds[promise.$$timeoutId];
        }

        if (!skipApply) $rootScope.$apply();
      }
*/

any ideas what might be going on?

0 Answers
Related