{"action":"created","comment":{"url":"https://api.github.com/repos/angular/angular/pulls/comments/41668334","id":41668334,"diff_hunk":"@@ -0,0 +1,134 @@\n+/// <reference path=\"../../typings/jasmine/jasmine.d.ts\"/>\n+\n+\n+/**\n+ * Public Test Library for unit testing Angular2 Applications. Uses the\n+ * Jasmine framework.\n+ */\n+import {global, isFunction, isPromise, Math} from 'angular2/src/core/facade/lang';\n+\n+import {bind} from 'angular2/src/core/di';\n+\n+import {createTestInjector, FunctionWithParamTokens, inject} from './test_injector';\n+\n+export {inject} from './test_injector';\n+\n+export {expect} from './matchers';\n+\n+var _global: jasmine.GlobalPolluter = <any>(typeof window === 'undefined' ? global : window);\n+\n+export var afterEach: Function = _global.afterEach;\n+export var describe: Function = _global.describe;\n+export var ddescribe: Function = _global.fdescribe;\n+export var xdescribe: Function = _global.xdescribe;\n+\n+export type SyncTestFn = () => void;\n+export type AsyncTestFn = (done: () => void) => void;\n+export type AnyTestFn = SyncTestFn | AsyncTestFn;\n+\n+var jsmBeforeEach = _global.beforeEach;\n+var jsmIt = _global.it;\n+var jsmIIt = _global.fit;\n+var jsmXIt = _global.xit;\n+\n+var testBindings;\n+var injector;\n+\n+// Reset the test bindings before each test.\n+jsmBeforeEach(() => {\n+  testBindings = [];\n+  injector = null;\n+});\n+\n+/**\n+ * Allows overriding default bindings of the test injector,\n+ * defined in test_injector.js.\n+ *\n+ * The given function must return a list of DI bindings.\n+ *\n+ * Example:\n+ *\n+ *   beforeEachBindings(() => [\n+ *     bind(Compiler).toClass(MockCompiler),\n+ *     bind(SomeToken).toValue(myValue),\n+ *   ]);\n+ */\n+export function beforeEachBindings(fn): void {\n+  jsmBeforeEach(() => {\n+    var bindings = fn();\n+    if (!bindings) return;\n+    testBindings = [...testBindings, ...bindings];\n+    if (injector !== null) {\n+      throw new Error('beforeEachBindings was called after the injector had ' +\n+                      'been used in a beforeEach or it block. This invalidates the ' +\n+                      'test injector');\n+    }\n+  });\n+}\n+\n+function _it(jsmFn: Function, name: string, testFn: FunctionWithParamTokens | AnyTestFn,\n+             testTimeOut: number): void {\n+  var timeOut = testTimeOut;\n+\n+  if (testFn instanceof FunctionWithParamTokens) {\n+    // The test case uses inject(). ie `it('test', inject([ClassA], (a) => { ...\n+    // }));`\n+    jsmFn(name, (done) => {\n+      if (!injector) {\n+        injector = createTestInjector(testBindings);\n+      }\n+      var returned = testFn.execute(injector);\n+      if (isPromise(returned)) {\n+        returned.then(done, done.fail);\n+      } else {\n+        done();","path":"modules/angular2/src/test_lib/test_lib_public.ts","position":84,"original_position":84,"commit_id":"7cafb82e8d97f76aad43180051a666a4da3f3f71","original_commit_id":"1853732e0198736674c4d1171885355cfba51169","user":{"login":"vicb","id":248818,"avatar_url":"https://avatars.githubusercontent.com/u/248818?v=3","gravatar_id":"","url":"https://api.github.com/users/vicb","html_url":"https://github.com/vicb","followers_url":"https://api.github.com/users/vicb/followers","following_url":"https://api.github.com/users/vicb/following{/other_user}","gists_url":"https://api.github.com/users/vicb/gists{/gist_id}","starred_url":"https://api.github.com/users/vicb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vicb/subscriptions","organizations_url":"https://api.github.com/users/vicb/orgs","repos_url":"https://api.github.com/users/vicb/repos","events_url":"https://api.github.com/users/vicb/events{/privacy}","received_events_url":"https://api.github.com/users/vicb/received_events","type":"User","site_admin":false},"body":"I'm -1 on this.\r\nAlso @IgorMinar was against running async tests when not strictly required(ie calling jasmine's `it` with `done` when no required)","created_at":"2015-10-09T19:23:03Z","updated_at":"2015-10-09T19:23:03Z","html_url":"https://github.com/angular/angular/pull/4624#discussion_r41668334","pull_request_url":"https://api.github.com/repos/angular/angular/pulls/4624","_links":{"self":{"href":"https://api.github.com/repos/angular/angular/pulls/comments/41668334"},"html":{"href":"https://github.com/angular/angular/pull/4624#discussion_r41668334"},"pull_request":{"href":"https://api.github.com/repos/angular/angular/pulls/4624"}}},"pull_request":{"url":"https://api.github.com/repos/angular/angular/pulls/4624","id":47235508,"html_url":"https://github.com/angular/angular/pull/4624","diff_url":"https://github.com/angular/angular/pull/4624.diff","patch_url":"https://github.com/angular/angular/pull/4624.patch","issue_url":"https://api.github.com/repos/angular/angular/issues/4624","number":4624,"state":"open","locked":false,"title":"feat(test): Add an external version of the test library","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},"body":"Adds test adapters for TypeScript and JavaScript only, exported\r\nas part of the test_lib module. These work with the Jasmine test\r\nframework, and allow use of the test injector within test blocks\r\nvia the `inject` function.\r\n\r\nSee #4572, #4177, #4035, #2783\r\n\r\nThis includes the TestComponentBuilder. It allows using the\r\ntest injector with Jasmine bindings, and waits for returned\r\npromises before completing async test blocks.","created_at":"2015-10-09T05:31:57Z","updated_at":"2015-10-09T19:23:03Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ea1e61e5adc74eeae05b0bcfb23ab88c9403615c","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/angular/angular/pulls/4624/commits","review_comments_url":"https://api.github.com/repos/angular/angular/pulls/4624/comments","review_comment_url":"https://api.github.com/repos/angular/angular/pulls/comments{/number}","comments_url":"https://api.github.com/repos/angular/angular/issues/4624/comments","statuses_url":"https://api.github.com/repos/angular/angular/statuses/7cafb82e8d97f76aad43180051a666a4da3f3f71","head":{"label":"juliemr:testapi-3a","ref":"testapi-3a","sha":"7cafb82e8d97f76aad43180051a666a4da3f3f71","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},"repo":{"id":28985296,"name":"angular","full_name":"juliemr/angular","owner":{"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},"private":false,"html_url":"https://github.com/juliemr/angular","description":"","fork":true,"url":"https://api.github.com/repos/juliemr/angular","forks_url":"https://api.github.com/repos/juliemr/angular/forks","keys_url":"https://api.github.com/repos/juliemr/angular/keys{/key_id}","collaborators_url":"https://api.github.com/repos/juliemr/angular/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/juliemr/angular/teams","hooks_url":"https://api.github.com/repos/juliemr/angular/hooks","issue_events_url":"https://api.github.com/repos/juliemr/angular/issues/events{/number}","events_url":"https://api.github.com/repos/juliemr/angular/events","assignees_url":"https://api.github.com/repos/juliemr/angular/assignees{/user}","branches_url":"https://api.github.com/repos/juliemr/angular/branches{/branch}","tags_url":"https://api.github.com/repos/juliemr/angular/tags","blobs_url":"https://api.github.com/repos/juliemr/angular/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/juliemr/angular/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/juliemr/angular/git/refs{/sha}","trees_url":"https://api.github.com/repos/juliemr/angular/git/trees{/sha}","statuses_url":"https://api.github.com/repos/juliemr/angular/statuses/{sha}","languages_url":"https://api.github.com/repos/juliemr/angular/languages","stargazers_url":"https://api.github.com/repos/juliemr/angular/stargazers","contributors_url":"https://api.github.com/repos/juliemr/angular/contributors","subscribers_url":"https://api.github.com/repos/juliemr/angular/subscribers","subscription_url":"https://api.github.com/repos/juliemr/angular/subscription","commits_url":"https://api.github.com/repos/juliemr/angular/commits{/sha}","git_commits_url":"https://api.github.com/repos/juliemr/angular/git/commits{/sha}","comments_url":"https://api.github.com/repos/juliemr/angular/comments{/number}","issue_comment_url":"https://api.github.com/repos/juliemr/angular/issues/comments{/number}","contents_url":"https://api.github.com/repos/juliemr/angular/contents/{+path}","compare_url":"https://api.github.com/repos/juliemr/angular/compare/{base}...{head}","merges_url":"https://api.github.com/repos/juliemr/angular/merges","archive_url":"https://api.github.com/repos/juliemr/angular/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/juliemr/angular/downloads","issues_url":"https://api.github.com/repos/juliemr/angular/issues{/number}","pulls_url":"https://api.github.com/repos/juliemr/angular/pulls{/number}","milestones_url":"https://api.github.com/repos/juliemr/angular/milestones{/number}","notifications_url":"https://api.github.com/repos/juliemr/angular/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/juliemr/angular/labels{/name}","releases_url":"https://api.github.com/repos/juliemr/angular/releases{/id}","created_at":"2015-01-08T20:46:47Z","updated_at":"2015-07-16T01:51:08Z","pushed_at":"2015-10-09T18:49:49Z","git_url":"git://github.com/juliemr/angular.git","ssh_url":"git@github.com:juliemr/angular.git","clone_url":"https://github.com/juliemr/angular.git","svn_url":"https://github.com/juliemr/angular","homepage":null,"size":16770,"stargazers_count":0,"watchers_count":0,"language":"TypeScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"angular:master","ref":"master","sha":"c178ad476e5286b73b037a251d8709d511a6373f","user":{"login":"angular","id":139426,"avatar_url":"https://avatars.githubusercontent.com/u/139426?v=3","gravatar_id":"","url":"https://api.github.com/users/angular","html_url":"https://github.com/angular","followers_url":"https://api.github.com/users/angular/followers","following_url":"https://api.github.com/users/angular/following{/other_user}","gists_url":"https://api.github.com/users/angular/gists{/gist_id}","starred_url":"https://api.github.com/users/angular/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/angular/subscriptions","organizations_url":"https://api.github.com/users/angular/orgs","repos_url":"https://api.github.com/users/angular/repos","events_url":"https://api.github.com/users/angular/events{/privacy}","received_events_url":"https://api.github.com/users/angular/received_events","type":"Organization","site_admin":false},"repo":{"id":24195339,"name":"angular","full_name":"angular/angular","owner":{"login":"angular","id":139426,"avatar_url":"https://avatars.githubusercontent.com/u/139426?v=3","gravatar_id":"","url":"https://api.github.com/users/angular","html_url":"https://github.com/angular","followers_url":"https://api.github.com/users/angular/followers","following_url":"https://api.github.com/users/angular/following{/other_user}","gists_url":"https://api.github.com/users/angular/gists{/gist_id}","starred_url":"https://api.github.com/users/angular/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/angular/subscriptions","organizations_url":"https://api.github.com/users/angular/orgs","repos_url":"https://api.github.com/users/angular/repos","events_url":"https://api.github.com/users/angular/events{/privacy}","received_events_url":"https://api.github.com/users/angular/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/angular/angular","description":"","fork":false,"url":"https://api.github.com/repos/angular/angular","forks_url":"https://api.github.com/repos/angular/angular/forks","keys_url":"https://api.github.com/repos/angular/angular/keys{/key_id}","collaborators_url":"https://api.github.com/repos/angular/angular/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/angular/angular/teams","hooks_url":"https://api.github.com/repos/angular/angular/hooks","issue_events_url":"https://api.github.com/repos/angular/angular/issues/events{/number}","events_url":"https://api.github.com/repos/angular/angular/events","assignees_url":"https://api.github.com/repos/angular/angular/assignees{/user}","branches_url":"https://api.github.com/repos/angular/angular/branches{/branch}","tags_url":"https://api.github.com/repos/angular/angular/tags","blobs_url":"https://api.github.com/repos/angular/angular/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/angular/angular/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/angular/angular/git/refs{/sha}","trees_url":"https://api.github.com/repos/angular/angular/git/trees{/sha}","statuses_url":"https://api.github.com/repos/angular/angular/statuses/{sha}","languages_url":"https://api.github.com/repos/angular/angular/languages","stargazers_url":"https://api.github.com/repos/angular/angular/stargazers","contributors_url":"https://api.github.com/repos/angular/angular/contributors","subscribers_url":"https://api.github.com/repos/angular/angular/subscribers","subscription_url":"https://api.github.com/repos/angular/angular/subscription","commits_url":"https://api.github.com/repos/angular/angular/commits{/sha}","git_commits_url":"https://api.github.com/repos/angular/angular/git/commits{/sha}","comments_url":"https://api.github.com/repos/angular/angular/comments{/number}","issue_comment_url":"https://api.github.com/repos/angular/angular/issues/comments{/number}","contents_url":"https://api.github.com/repos/angular/angular/contents/{+path}","compare_url":"https://api.github.com/repos/angular/angular/compare/{base}...{head}","merges_url":"https://api.github.com/repos/angular/angular/merges","archive_url":"https://api.github.com/repos/angular/angular/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/angular/angular/downloads","issues_url":"https://api.github.com/repos/angular/angular/issues{/number}","pulls_url":"https://api.github.com/repos/angular/angular/pulls{/number}","milestones_url":"https://api.github.com/repos/angular/angular/milestones{/number}","notifications_url":"https://api.github.com/repos/angular/angular/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/angular/angular/labels{/name}","releases_url":"https://api.github.com/repos/angular/angular/releases{/id}","created_at":"2014-09-18T16:12:01Z","updated_at":"2015-10-09T18:40:33Z","pushed_at":"2015-10-09T19:04:39Z","git_url":"git://github.com/angular/angular.git","ssh_url":"git@github.com:angular/angular.git","clone_url":"https://github.com/angular/angular.git","svn_url":"https://github.com/angular/angular","homepage":"https://angular.io","size":61248,"stargazers_count":5719,"watchers_count":5719,"language":"TypeScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1560,"mirror_url":null,"open_issues_count":528,"forks":1560,"open_issues":528,"watchers":5719,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/angular/angular/pulls/4624"},"html":{"href":"https://github.com/angular/angular/pull/4624"},"issue":{"href":"https://api.github.com/repos/angular/angular/issues/4624"},"comments":{"href":"https://api.github.com/repos/angular/angular/issues/4624/comments"},"review_comments":{"href":"https://api.github.com/repos/angular/angular/pulls/4624/comments"},"review_comment":{"href":"https://api.github.com/repos/angular/angular/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/angular/angular/pulls/4624/commits"},"statuses":{"href":"https://api.github.com/repos/angular/angular/statuses/7cafb82e8d97f76aad43180051a666a4da3f3f71"}}}}