{"action":"created","issue":{"url":"https://api.github.com/repos/jasmine/jasmine/issues/567","labels_url":"https://api.github.com/repos/jasmine/jasmine/issues/567/labels{/name}","comments_url":"https://api.github.com/repos/jasmine/jasmine/issues/567/comments","events_url":"https://api.github.com/repos/jasmine/jasmine/issues/567/events","html_url":"https://github.com/jasmine/jasmine/issues/567","id":30701104,"number":567,"title":"Allow done() to take an optional error.","user":{"login":"nikku","id":58601,"avatar_url":"https://avatars.githubusercontent.com/u/58601?v=3","gravatar_id":"","url":"https://api.github.com/users/nikku","html_url":"https://github.com/nikku","followers_url":"https://api.github.com/users/nikku/followers","following_url":"https://api.github.com/users/nikku/following{/other_user}","gists_url":"https://api.github.com/users/nikku/gists{/gist_id}","starred_url":"https://api.github.com/users/nikku/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nikku/subscriptions","organizations_url":"https://api.github.com/users/nikku/orgs","repos_url":"https://api.github.com/users/nikku/repos","events_url":"https://api.github.com/users/nikku/events{/privacy}","received_events_url":"https://api.github.com/users/nikku/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/jasmine/jasmine/labels/waiting","name":"waiting","color":"e102d8"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":20,"created_at":"2014-04-02T16:02:53Z","updated_at":"2015-07-14T07:17:53Z","closed_at":"2014-10-02T15:16:50Z","body":"It is a popular pattern to pass an error object to a `done()` callback in NodeJS.\r\nWe should support that in Jasmine 2.0, too so that users can properly unit test asynchronous code.\r\n\r\n#### Example\r\n\r\n```\r\ndescribe('async with error', function() {\r\n\r\n  it('should fail on done(err)', function(done) {\r\n    \r\n    setTimeout(function() {\r\n      done(new Error('async fail'));\r\n    }, 100);\r\n  });\r\n});\r\n```\r\n\r\nshould fail with \r\n\r\n```\r\nerror: 'async fail'\r\n```\r\n\r\ninstead of succeeding which is the case as of `v2.0.0`."},"comment":{"url":"https://api.github.com/repos/jasmine/jasmine/issues/comments/121150490","html_url":"https://github.com/jasmine/jasmine/issues/567#issuecomment-121150490","issue_url":"https://api.github.com/repos/jasmine/jasmine/issues/567","id":121150490,"user":{"login":"straker","id":2433219,"avatar_url":"https://avatars.githubusercontent.com/u/2433219?v=3","gravatar_id":"","url":"https://api.github.com/users/straker","html_url":"https://github.com/straker","followers_url":"https://api.github.com/users/straker/followers","following_url":"https://api.github.com/users/straker/following{/other_user}","gists_url":"https://api.github.com/users/straker/gists{/gist_id}","starred_url":"https://api.github.com/users/straker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/straker/subscriptions","organizations_url":"https://api.github.com/users/straker/orgs","repos_url":"https://api.github.com/users/straker/repos","events_url":"https://api.github.com/users/straker/events{/privacy}","received_events_url":"https://api.github.com/users/straker/received_events","type":"User","site_admin":false},"created_at":"2015-07-14T07:17:53Z","updated_at":"2015-07-14T07:17:53Z","body":"Could we get this feature of `done.fail` in the jasmine docs? I spent the last hour trying to google how to not have Jasmine timeout when an async assertion fails, and finally stumbled upon this issue."}}