{"action":"created","issue":{"url":"https://api.github.com/repos/sindresorhus/ava/issues/199","labels_url":"https://api.github.com/repos/sindresorhus/ava/issues/199/labels{/name}","comments_url":"https://api.github.com/repos/sindresorhus/ava/issues/199/comments","events_url":"https://api.github.com/repos/sindresorhus/ava/issues/199/events","html_url":"https://github.com/sindresorhus/ava/pull/199","id":116520131,"number":199,"title":"(don't merge): Demonstrate problematic async with t.end as callback.","user":{"login":"jamestalmage","id":4082216,"avatar_url":"https://avatars.githubusercontent.com/u/4082216?v=3","gravatar_id":"","url":"https://api.github.com/users/jamestalmage","html_url":"https://github.com/jamestalmage","followers_url":"https://api.github.com/users/jamestalmage/followers","following_url":"https://api.github.com/users/jamestalmage/following{/other_user}","gists_url":"https://api.github.com/users/jamestalmage/gists{/gist_id}","starred_url":"https://api.github.com/users/jamestalmage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jamestalmage/subscriptions","organizations_url":"https://api.github.com/users/jamestalmage/orgs","repos_url":"https://api.github.com/users/jamestalmage/repos","events_url":"https://api.github.com/users/jamestalmage/events{/privacy}","received_events_url":"https://api.github.com/users/jamestalmage/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-11-12T10:23:09Z","updated_at":"2015-11-17T11:33:24Z","closed_at":"2015-11-17T11:20:25Z","pull_request":{"url":"https://api.github.com/repos/sindresorhus/ava/pulls/199","html_url":"https://github.com/sindresorhus/ava/pull/199","diff_url":"https://github.com/sindresorhus/ava/pull/199.diff","patch_url":"https://github.com/sindresorhus/ava/pull/199.patch"},"body":"I have found a potentially problematic usage scenarios as it relates to #181.\r\n\r\nWe support returning promises as a way to end the test, and also encourage the use of async functions (which are simply transpiled to return Promieses anyway).\r\n\r\nIn PR #181 we are close to allowing `t.end` to be used as a callback.\r\n\r\nThe sample fixture in this PR illustrates the problem.\r\n\r\nUsing an async function, but passing `t.end` as a callback to some method that will not call the callback with an error until sometime after the promise resolves may mean the forked process has been forcibly killed already and we have a false pass.\r\n\r\nI'm not sure how to handle this.\r\n\r\nPossibly use a property getter for `t.end` that flags when the property has been accessed, and disables Promise resolution as a way to end the test? (though that could lead to a really confusing situation as well)."},"comment":{"url":"https://api.github.com/repos/sindresorhus/ava/issues/comments/157343619","html_url":"https://github.com/sindresorhus/ava/pull/199#issuecomment-157343619","issue_url":"https://api.github.com/repos/sindresorhus/ava/issues/199","id":157343619,"user":{"login":"sindresorhus","id":170270,"avatar_url":"https://avatars.githubusercontent.com/u/170270?v=3","gravatar_id":"","url":"https://api.github.com/users/sindresorhus","html_url":"https://github.com/sindresorhus","followers_url":"https://api.github.com/users/sindresorhus/followers","following_url":"https://api.github.com/users/sindresorhus/following{/other_user}","gists_url":"https://api.github.com/users/sindresorhus/gists{/gist_id}","starred_url":"https://api.github.com/users/sindresorhus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sindresorhus/subscriptions","organizations_url":"https://api.github.com/users/sindresorhus/orgs","repos_url":"https://api.github.com/users/sindresorhus/repos","events_url":"https://api.github.com/users/sindresorhus/events{/privacy}","received_events_url":"https://api.github.com/users/sindresorhus/received_events","type":"User","site_admin":false},"created_at":"2015-11-17T11:33:24Z","updated_at":"2015-11-17T11:33:24Z","body":"@vdemedes You're saying that as if most users actually read the docs :p"}}