{"action":"opened","issue":{"url":"https://api.github.com/repos/angular/angular.js/issues/14336","repository_url":"https://api.github.com/repos/angular/angular.js","labels_url":"https://api.github.com/repos/angular/angular.js/issues/14336/labels{/name}","comments_url":"https://api.github.com/repos/angular/angular.js/issues/14336/comments","events_url":"https://api.github.com/repos/angular/angular.js/issues/14336/events","html_url":"https://github.com/angular/angular.js/issues/14336","id":144197909,"number":14336,"title":"fix($timeout): `verifyNoPendingTasks()` throws even for non-timeout pending tasks","user":{"login":"gkalpak","id":8604205,"avatar_url":"https://avatars.githubusercontent.com/u/8604205?v=3","gravatar_id":"","url":"https://api.github.com/users/gkalpak","html_url":"https://github.com/gkalpak","followers_url":"https://api.github.com/users/gkalpak/followers","following_url":"https://api.github.com/users/gkalpak/following{/other_user}","gists_url":"https://api.github.com/users/gkalpak/gists{/gist_id}","starred_url":"https://api.github.com/users/gkalpak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gkalpak/subscriptions","organizations_url":"https://api.github.com/users/gkalpak/orgs","repos_url":"https://api.github.com/users/gkalpak/repos","events_url":"https://api.github.com/users/gkalpak/events{/privacy}","received_events_url":"https://api.github.com/users/gkalpak/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-03-29T08:51:15Z","updated_at":"2016-03-29T08:51:15Z","closed_at":null,"body":"\r\n**Do you want to request a *feature* or report a *bug*?**\r\n\r\nBug\r\n\r\n**What is the current behavior?**\r\n\r\n`ngMock`'s [$timeout.verifyNoPendingTasks()][1] throws if there are deferred tasks that are not related to `$timeout`.\r\n[Reproduction][2]\r\n\r\n**What is the expected behavior?**\r\n\r\n`ngMock`'s [$timeout.verifyNoPendingTasks()][1] should not throw if there are deferred tasks that are not related to `$timeout`.\r\n\r\n**What is the motivation / use case for changing the behavior?**\r\n\r\nIt makes it difficult/unintuitive to test code that uses `$timeout` wrt pending tasks.\r\n\r\n**Which versions of Angular, and which browser / OS are affected by this issue? Did this work in previous versions of Angular? Please also test with the latest stable and snapshot (https://code.angularjs.org/snapshot/) versions.**\r\n\r\nAngular versions: 1.4 and 1.5 (those I tested with, but should affect oldrer versions too)\r\nBrowsers: All\r\n\r\n**Other information (e.g. stacktraces, related issues, suggestions how to fix)**\r\n\r\nWhen this method was introduced (back in f0c6ebc), `$timeout` was probably the only service that used `$browser.defer()`, so all `$browser.deferredFns` came from `$timeout` (thus an non-empty array, meant pending timeouts).\r\nThis is no longer the case. E.g. `$browser.defer()` is used in `$evalAsync()` and `$applyAsync()`, which means it transitively used throughout Angular (in watchers, directives etc).\r\n\r\n[1]: https://docs.angularjs.org/api/ngMock/service/$timeout#verifyNoPendingTasks\r\n[2]: https://codepen.io/ExpertSystem/pen/mPMJmW?editors=0010"}}