{"action":"created","issue":{"url":"https://api.github.com/repos/angular/angular/issues/4572","labels_url":"https://api.github.com/repos/angular/angular/issues/4572/labels{/name}","comments_url":"https://api.github.com/repos/angular/angular/issues/4572/comments","events_url":"https://api.github.com/repos/angular/angular/issues/4572/events","html_url":"https://github.com/angular/angular/issues/4572","id":110157126,"number":4572,"title":"Add an `injectAsync` helper to the test_lib","user":{"login":"juliemr","id":2081709,"avatar_url":"https://avatars.githubusercontent.com/u/2081709?v=3","gravatar_id":"","url":"https://api.github.com/users/juliemr","html_url":"https://github.com/juliemr","followers_url":"https://api.github.com/users/juliemr/followers","following_url":"https://api.github.com/users/juliemr/following{/other_user}","gists_url":"https://api.github.com/users/juliemr/gists{/gist_id}","starred_url":"https://api.github.com/users/juliemr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/juliemr/subscriptions","organizations_url":"https://api.github.com/users/juliemr/orgs","repos_url":"https://api.github.com/users/juliemr/repos","events_url":"https://api.github.com/users/juliemr/events{/privacy}","received_events_url":"https://api.github.com/users/juliemr/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/angular/angular/labels/comp:%20core/testbed","name":"comp: core/testbed","color":"c7def8"},{"url":"https://api.github.com/repos/angular/angular/labels/P1:%20urgent","name":"P1: urgent","color":"eb6420"},{"url":"https://api.github.com/repos/angular/angular/labels/state:%20Needs%20Design","name":"state: Needs Design","color":"006b75"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-10-07T05:59:25Z","updated_at":"2015-10-08T00:29:09Z","closed_at":null,"body":"The problem:\r\n\r\nCurrently, using the test injector with an async test is wordy and unintuitive:\r\n```js\r\nimport {it, inject, AsyncTestCompleter} from 'angular2/test_lib';\r\n\r\nit('does stuff', inject[ClassA, ClassB, AsyncTestCompleter], (a, b, async) => {\r\n  async.done();\r\n});\r\n```\r\n\r\nThere's a split in the code path anyway for async / not-async, so let's just make this explicit:\r\n\r\n```js\r\nimport {it, injectAsync} from 'angular2/test_lib';\r\n\r\nit('does stuff', injectAsync[ClassA, ClassB], (a, b, done) => {\r\n  done();\r\n});\r\n```\r\n\r\nWe could deprecate the AsyncTestCompleter separately if we don't want two ways of doing the same thing.\r\n\r\nThoughts?\r\n\r\ncc @wardbell and see his version at https://github.com/angular/angular/issues/4035#issuecomment-143937352\r\n\r\ncc @vicb for thoughts."},"comment":{"url":"https://api.github.com/repos/angular/angular/issues/comments/146379360","html_url":"https://github.com/angular/angular/issues/4572#issuecomment-146379360","issue_url":"https://api.github.com/repos/angular/angular/issues/4572","id":146379360,"user":{"login":"tbosch","id":690815,"avatar_url":"https://avatars.githubusercontent.com/u/690815?v=3","gravatar_id":"","url":"https://api.github.com/users/tbosch","html_url":"https://github.com/tbosch","followers_url":"https://api.github.com/users/tbosch/followers","following_url":"https://api.github.com/users/tbosch/following{/other_user}","gists_url":"https://api.github.com/users/tbosch/gists{/gist_id}","starred_url":"https://api.github.com/users/tbosch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tbosch/subscriptions","organizations_url":"https://api.github.com/users/tbosch/orgs","repos_url":"https://api.github.com/users/tbosch/repos","events_url":"https://api.github.com/users/tbosch/events{/privacy}","received_events_url":"https://api.github.com/users/tbosch/received_events","type":"User","site_admin":false},"created_at":"2015-10-08T00:29:09Z","updated_at":"2015-10-08T00:29:09Z","body":"Victor, the tests need the runtime compiler, which only works with Mirrors\nOn Wed, Oct 7, 2015 at 4:51 PM Julie Ralph <notifications@github.com> wrote:\n\n> Here's a stab at this:\n>\n> master...juliemr:testapi\n> <https://github.com/angular/angular/compare/master...juliemr:testapi>\n>\n> I haven't looked at how it would work with Dart at all yet.\n>\n> —\n> Reply to this email directly or view it on GitHub\n> <https://github.com/angular/angular/issues/4572#issuecomment-146369449>.\n>\n"}}