{"action":"created","issue":{"url":"https://api.github.com/repos/Olivine-Labs/busted/issues/439","labels_url":"https://api.github.com/repos/Olivine-Labs/busted/issues/439/labels{/name}","comments_url":"https://api.github.com/repos/Olivine-Labs/busted/issues/439/comments","events_url":"https://api.github.com/repos/Olivine-Labs/busted/issues/439/events","html_url":"https://github.com/Olivine-Labs/busted/pull/439","id":93427129,"number":439,"title":"Implement async. WIP","user":{"login":"DorianGray","id":116584,"avatar_url":"https://avatars.githubusercontent.com/u/116584?v=3","gravatar_id":"","url":"https://api.github.com/users/DorianGray","html_url":"https://github.com/DorianGray","followers_url":"https://api.github.com/users/DorianGray/followers","following_url":"https://api.github.com/users/DorianGray/following{/other_user}","gists_url":"https://api.github.com/users/DorianGray/gists{/gist_id}","starred_url":"https://api.github.com/users/DorianGray/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DorianGray/subscriptions","organizations_url":"https://api.github.com/users/DorianGray/orgs","repos_url":"https://api.github.com/users/DorianGray/repos","events_url":"https://api.github.com/users/DorianGray/events{/privacy}","received_events_url":"https://api.github.com/users/DorianGray/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-07-07T03:19:03Z","updated_at":"2015-07-07T19:39:53Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/Olivine-Labs/busted/pulls/439","html_url":"https://github.com/Olivine-Labs/busted/pull/439","diff_url":"https://github.com/Olivine-Labs/busted/pull/439.diff","patch_url":"https://github.com/Olivine-Labs/busted/pull/439.patch"},"body":""},"comment":{"url":"https://api.github.com/repos/Olivine-Labs/busted/issues/comments/119314027","html_url":"https://github.com/Olivine-Labs/busted/pull/439#issuecomment-119314027","issue_url":"https://api.github.com/repos/Olivine-Labs/busted/issues/439","id":119314027,"user":{"login":"o-lim","id":10095424,"avatar_url":"https://avatars.githubusercontent.com/u/10095424?v=3","gravatar_id":"","url":"https://api.github.com/users/o-lim","html_url":"https://github.com/o-lim","followers_url":"https://api.github.com/users/o-lim/followers","following_url":"https://api.github.com/users/o-lim/following{/other_user}","gists_url":"https://api.github.com/users/o-lim/gists{/gist_id}","starred_url":"https://api.github.com/users/o-lim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/o-lim/subscriptions","organizations_url":"https://api.github.com/users/o-lim/orgs","repos_url":"https://api.github.com/users/o-lim/repos","events_url":"https://api.github.com/users/o-lim/events{/privacy}","received_events_url":"https://api.github.com/users/o-lim/received_events","type":"User","site_admin":false},"created_at":"2015-07-07T19:39:53Z","updated_at":"2015-07-07T19:39:53Z","body":"I'm not sure what you mean by `disconnected block ends`.  Wouldn't you just add `async` to `it`/`setup`/`teardown`/`before_each`/`after_each` blocks?  Wouldn't you just call the event loop inside the block after it returns from `busted.safe(descriptor, element.run, element)`?  `async` just means that the test or block depends on asynchronous inputs, right?  So, it's not like you should start executing the next block/test until the current block/test completes.\r\n\r\nMaybe something like:\r\n```lua\r\n    local async, evloop\r\n    element.env.async = function(loop)\r\n      async = true\r\n      evloop = loop\r\n      element.env.done = done.new(loop.stop)\r\n    end\r\n    if pass then\r\n      local status = busted.status('success')\r\n      if busted.safe_publish('it', { 'test', 'start' }, element, parent) then\r\n        status:update(busted.safe('it', element.run, element))\r\n        if status:success() then\r\n          status:update(busted.safe('it', evloop.run, element))\r\n        end\r\n        if finally then\r\n          block.reject('pending', element)\r\n          status:update(busted.safe('finally', finally, element))\r\n        end\r\n      else\r\n        status = busted.status('error')\r\n      end\r\n      busted.safe_publish('it', { 'test', 'end' }, element, parent, tostring(status))\r\n    end\r\n```\r\nDid you want to return `done` instead of injecting it into the environment?  Since `done` is not available until you call `async`, it might make more sense to return `done` in order to avoid possible confusion."}}