{"action":"created","issue":{"url":"https://api.github.com/repos/angular/angular.js/issues/13153","labels_url":"https://api.github.com/repos/angular/angular.js/issues/13153/labels{/name}","comments_url":"https://api.github.com/repos/angular/angular.js/issues/13153/comments","events_url":"https://api.github.com/repos/angular/angular.js/issues/13153/events","html_url":"https://github.com/angular/angular.js/issues/13153","id":112851006,"number":13153,"title":"$httpBackend does not respond to request when asynchronous beforeEach is used","user":{"login":"vrka","id":6906462,"avatar_url":"https://avatars.githubusercontent.com/u/6906462?v=3","gravatar_id":"","url":"https://api.github.com/users/vrka","html_url":"https://github.com/vrka","followers_url":"https://api.github.com/users/vrka/followers","following_url":"https://api.github.com/users/vrka/following{/other_user}","gists_url":"https://api.github.com/users/vrka/gists{/gist_id}","starred_url":"https://api.github.com/users/vrka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vrka/subscriptions","organizations_url":"https://api.github.com/users/vrka/orgs","repos_url":"https://api.github.com/users/vrka/repos","events_url":"https://api.github.com/users/vrka/events{/privacy}","received_events_url":"https://api.github.com/users/vrka/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-10-22T17:25:51Z","updated_at":"2015-10-22T19:11:21Z","closed_at":null,"body":"If asynchronous beforeEach in jasmine is used (via the parameter done) requests are not responded to. This test timeouts:\r\n\r\n```javascript\r\n      describe('Fails', function() {\r\n        beforeEach(function(done) {\r\n          $timeout(done, 10);\r\n        });\r\n        it('should work', function(done) {\r\n          $httpBackend.expectGET('url').respond();\r\n          $http.get('url').then(done);\r\n          $httpBackend.flush();\r\n        });\r\n      });\r\n```\r\nIf whole the `beforeEach` part is ommited the request is responded to.\r\n\r\nHere is a plunker http://plnkr.co/edit/dwe57Y21wBXcXiXU1Cqq\r\n\r\nwith jasmine 2.3.4 and angular 1.5.0-beta.1"},"comment":{"url":"https://api.github.com/repos/angular/angular.js/issues/comments/150326011","html_url":"https://github.com/angular/angular.js/issues/13153#issuecomment-150326011","issue_url":"https://api.github.com/repos/angular/angular.js/issues/13153","id":150326011,"user":{"login":"brandonroberts","id":42211,"avatar_url":"https://avatars.githubusercontent.com/u/42211?v=3","gravatar_id":"","url":"https://api.github.com/users/brandonroberts","html_url":"https://github.com/brandonroberts","followers_url":"https://api.github.com/users/brandonroberts/followers","following_url":"https://api.github.com/users/brandonroberts/following{/other_user}","gists_url":"https://api.github.com/users/brandonroberts/gists{/gist_id}","starred_url":"https://api.github.com/users/brandonroberts/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brandonroberts/subscriptions","organizations_url":"https://api.github.com/users/brandonroberts/orgs","repos_url":"https://api.github.com/users/brandonroberts/repos","events_url":"https://api.github.com/users/brandonroberts/events{/privacy}","received_events_url":"https://api.github.com/users/brandonroberts/received_events","type":"User","site_admin":false},"created_at":"2015-10-22T19:11:21Z","updated_at":"2015-10-22T19:11:21Z","body":"Trying using the done in your describe instead of your beforeEach. Once that done is finished the tests are ready to be run, so it should run correctly.\r\n\r\n```javascript\r\n      describe('Fails', function(done) {\r\n        beforeEach(function() {\r\n          $timeout(done, 10);\r\n        });\r\n        it('should work', function(done) {\r\n          $httpBackend.expectGET('url').respond();\r\n          $http.get('url').then(done);\r\n          $httpBackend.flush();\r\n        });\r\n      });\r\n```"}}