{"action":"opened","issue":{"url":"https://api.github.com/repos/jasmine/jasmine/issues/959","labels_url":"https://api.github.com/repos/jasmine/jasmine/issues/959/labels{/name}","comments_url":"https://api.github.com/repos/jasmine/jasmine/issues/959/comments","events_url":"https://api.github.com/repos/jasmine/jasmine/issues/959/events","html_url":"https://github.com/jasmine/jasmine/issues/959","id":113436182,"number":959,"title":"Testing the property of an undefined object","user":{"login":"Tetraib","id":4501377,"avatar_url":"https://avatars.githubusercontent.com/u/4501377?v=3","gravatar_id":"","url":"https://api.github.com/users/Tetraib","html_url":"https://github.com/Tetraib","followers_url":"https://api.github.com/users/Tetraib/followers","following_url":"https://api.github.com/users/Tetraib/following{/other_user}","gists_url":"https://api.github.com/users/Tetraib/gists{/gist_id}","starred_url":"https://api.github.com/users/Tetraib/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Tetraib/subscriptions","organizations_url":"https://api.github.com/users/Tetraib/orgs","repos_url":"https://api.github.com/users/Tetraib/repos","events_url":"https://api.github.com/users/Tetraib/events{/privacy}","received_events_url":"https://api.github.com/users/Tetraib/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-10-26T19:46:14Z","updated_at":"2015-10-26T19:46:14Z","closed_at":null,"body":"In the process of testing a REST API with the following code :\r\n \r\n    describe('GET /', function() {\r\n        it('should respond with 200', function(done) {\r\n            request(options, function(error, response, body) {\r\n                expect(response.statusCode).toBe(200);\r\n                done();\r\n             });\r\n         });\r\n    });\r\n\r\nIf the webservice is down, or the requested address is wrong, the response is not defined, all tests are skipped and jasmine fail with :\r\n  TypeError: Cannot read property 'statusCode' of undefined\r\n\r\nIf this situation I would expect jasmine to just report :\r\n  Expected undefined to be 200.\r\nIs jasmine failing this way by design ? And then how can I best prevent jasmine to completely fails in this situation ?\r\nOr\r\nShouldn't jasmine just report \"expected undefined <some matcher> something\" in case we are reading the property of an undefined object ?"}}