{"action":"created","issue":{"url":"https://api.github.com/repos/mochajs/mocha/issues/2509","repository_url":"https://api.github.com/repos/mochajs/mocha","labels_url":"https://api.github.com/repos/mochajs/mocha/issues/2509/labels{/name}","comments_url":"https://api.github.com/repos/mochajs/mocha/issues/2509/comments","events_url":"https://api.github.com/repos/mochajs/mocha/issues/2509/events","html_url":"https://github.com/mochajs/mocha/issues/2509","id":179859135,"number":2509,"title":"new test resolution behavior","user":{"login":"boneskull","id":924465,"avatar_url":"https://avatars.githubusercontent.com/u/924465?v=3","gravatar_id":"","url":"https://api.github.com/users/boneskull","html_url":"https://github.com/boneskull","followers_url":"https://api.github.com/users/boneskull/followers","following_url":"https://api.github.com/users/boneskull/following{/other_user}","gists_url":"https://api.github.com/users/boneskull/gists{/gist_id}","starred_url":"https://api.github.com/users/boneskull/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/boneskull/subscriptions","organizations_url":"https://api.github.com/users/boneskull/orgs","repos_url":"https://api.github.com/users/boneskull/repos","events_url":"https://api.github.com/users/boneskull/events{/privacy}","received_events_url":"https://api.github.com/users/boneskull/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/mochajs/mocha/labels/feature","name":"feature","color":"207de5"},{"url":"https://api.github.com/repos/mochajs/mocha/labels/major-release","name":"major-release","color":"d93f0b"},{"url":"https://api.github.com/repos/mochajs/mocha/labels/pr-please","name":"pr-please","color":"009800"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-09-28T19:02:21Z","updated_at":"2016-09-28T22:17:44Z","closed_at":null,"body":"See #2413 and other various issues and PRs for previous discussion.\r\n\r\nIn Mocha 2.x, when a `Promise` is returned from an \"async\" test (using the `done()` callback), the `Promise` resolution is effectively ignored, though it may cause an unhandled rejection *after* the test has finished.\r\n\r\nIn Mocha 3.x to the present, returning a `Promise` from an \"async\" test is disallowed; tests must use either `done()` or return a `Promise`, but not both.\r\n\r\nA better solution in this case would be to wait for both resolutions (the call of `done()` and `Promise` fulfillment) before the test can end.  \r\n\r\n### Specification\r\n\r\nWhen a test requests `done()` and returns a `Promise`:\r\n\r\n- and when it has fulfilled *before* `done()` is called\r\n  - and when the `Promise` has been resolved\r\n    - the runner should wait until `done()` is called to conclude the test\r\n    - and when `done()` is called with an error parameter\r\n      - the test should fail\r\n    - and when `done()` is called without an error parameter\r\n      - the test should pass\r\n  - and when the `Promise` has been rejected\r\n    - the runner should not wait until `done()` is called to conclude the test\r\n    - and when/if `done()` is eventually called, it should be ignored\r\n    - the test should fail warning the user that if `done()` was called,  any error parameter would have been ignored\r\n- and when `done()` is called before it is fulfilled\r\n  - and when `done()` is not called with an error parameter\r\n    - the runner should wait until `Promise` fulfillment to conclude the test\r\n    - and when the `Promise` has been rejected\r\n      - the test should fail\r\n    - and when the `Promise` has been resolved\r\n      - the test should pass\r\n  - and when `done()` is called with an error parameter\r\n    - the runner should not wait until `Promise` fulfillment to conclude the test\r\n    - and when/if the `Promise` fulfills, it should be ignored\r\n    - the test should fail warning the user that if the `Promise` has been rejected, any error parameter would have been ignored\r\n\r\nNormal timeout rules apply.\r\n\r\n* * *\r\n\r\nComments, suggestions, questions, concerns?"},"comment":{"url":"https://api.github.com/repos/mochajs/mocha/issues/comments/250318179","html_url":"https://github.com/mochajs/mocha/issues/2509#issuecomment-250318179","issue_url":"https://api.github.com/repos/mochajs/mocha/issues/2509","id":250318179,"user":{"login":"boneskull","id":924465,"avatar_url":"https://avatars.githubusercontent.com/u/924465?v=3","gravatar_id":"","url":"https://api.github.com/users/boneskull","html_url":"https://github.com/boneskull","followers_url":"https://api.github.com/users/boneskull/followers","following_url":"https://api.github.com/users/boneskull/following{/other_user}","gists_url":"https://api.github.com/users/boneskull/gists{/gist_id}","starred_url":"https://api.github.com/users/boneskull/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/boneskull/subscriptions","organizations_url":"https://api.github.com/users/boneskull/orgs","repos_url":"https://api.github.com/users/boneskull/repos","events_url":"https://api.github.com/users/boneskull/events{/privacy}","received_events_url":"https://api.github.com/users/boneskull/received_events","type":"User","site_admin":false},"created_at":"2016-09-28T22:17:44Z","updated_at":"2016-09-28T22:17:44Z","body":"I'm tagging this `major-release` because it will affect the behavior of existing tests; some tests may newly fail or pass, depending."}}
{"actor":{"display_login":"boneskull"}}