{"action":"created","issue":{"url":"https://api.github.com/repos/angular/angular.js/issues/14093","repository_url":"https://api.github.com/repos/angular/angular.js","labels_url":"https://api.github.com/repos/angular/angular.js/issues/14093/labels{/name}","comments_url":"https://api.github.com/repos/angular/angular.js/issues/14093/comments","events_url":"https://api.github.com/repos/angular/angular.js/issues/14093/events","html_url":"https://github.com/angular/angular.js/pull/14093","id":135090648,"number":14093,"title":"feat(ngMock): add sharedInjector() to angular.mock.module","user":{"login":"timruffles","id":249800,"avatar_url":"https://avatars.githubusercontent.com/u/249800?v=3","gravatar_id":"","url":"https://api.github.com/users/timruffles","html_url":"https://github.com/timruffles","followers_url":"https://api.github.com/users/timruffles/followers","following_url":"https://api.github.com/users/timruffles/following{/other_user}","gists_url":"https://api.github.com/users/timruffles/gists{/gist_id}","starred_url":"https://api.github.com/users/timruffles/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timruffles/subscriptions","organizations_url":"https://api.github.com/users/timruffles/orgs","repos_url":"https://api.github.com/users/timruffles/repos","events_url":"https://api.github.com/users/timruffles/events{/privacy}","received_events_url":"https://api.github.com/users/timruffles/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/angular/angular.js/labels/cla:%20yes","name":"cla: yes","color":"bfe5bf"},{"url":"https://api.github.com/repos/angular/angular.js/labels/component:%20ngMock","name":"component: ngMock","color":"bfd4f2"},{"url":"https://api.github.com/repos/angular/angular.js/labels/needs:%20review","name":"needs: review","color":"eb6420"},{"url":"https://api.github.com/repos/angular/angular.js/labels/type:%20feature","name":"type: feature","color":"00a606"}],"state":"open","locked":false,"assignee":{"login":"petebacondarwin","id":15655,"avatar_url":"https://avatars.githubusercontent.com/u/15655?v=3","gravatar_id":"","url":"https://api.github.com/users/petebacondarwin","html_url":"https://github.com/petebacondarwin","followers_url":"https://api.github.com/users/petebacondarwin/followers","following_url":"https://api.github.com/users/petebacondarwin/following{/other_user}","gists_url":"https://api.github.com/users/petebacondarwin/gists{/gist_id}","starred_url":"https://api.github.com/users/petebacondarwin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/petebacondarwin/subscriptions","organizations_url":"https://api.github.com/users/petebacondarwin/orgs","repos_url":"https://api.github.com/users/petebacondarwin/repos","events_url":"https://api.github.com/users/petebacondarwin/events{/privacy}","received_events_url":"https://api.github.com/users/petebacondarwin/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/angular/angular.js/milestones/90","html_url":"https://github.com/angular/angular.js/milestones/1.5.x","labels_url":"https://api.github.com/repos/angular/angular.js/milestones/90/labels","id":1025270,"number":90,"title":"1.5.x","description":"","creator":{"login":"petebacondarwin","id":15655,"avatar_url":"https://avatars.githubusercontent.com/u/15655?v=3","gravatar_id":"","url":"https://api.github.com/users/petebacondarwin","html_url":"https://github.com/petebacondarwin","followers_url":"https://api.github.com/users/petebacondarwin/followers","following_url":"https://api.github.com/users/petebacondarwin/following{/other_user}","gists_url":"https://api.github.com/users/petebacondarwin/gists{/gist_id}","starred_url":"https://api.github.com/users/petebacondarwin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/petebacondarwin/subscriptions","organizations_url":"https://api.github.com/users/petebacondarwin/orgs","repos_url":"https://api.github.com/users/petebacondarwin/repos","events_url":"https://api.github.com/users/petebacondarwin/events{/privacy}","received_events_url":"https://api.github.com/users/petebacondarwin/received_events","type":"User","site_admin":false},"open_issues":90,"closed_issues":94,"state":"open","created_at":"2015-03-17T12:15:49Z","updated_at":"2016-02-24T17:03:24Z","due_on":null,"closed_at":null},"comments":6,"created_at":"2016-02-20T16:04:26Z","updated_at":"2016-02-24T18:01:48Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/angular/angular.js/pulls/14093","html_url":"https://github.com/angular/angular.js/pull/14093","diff_url":"https://github.com/angular/angular.js/pull/14093.diff","patch_url":"https://github.com/angular/angular.js/pull/14093.patch"},"body":"Allows users to opt-in to using a shared injector within a `describe()` context, via `angular.mock.module.sharedInjector()`.\r\n\r\nThis enables Jasmine 2.x/mocha's `beforeAll()`/`before()` hooks to be used with Angular, fixing issue #10238 as previously discussed.\r\n\r\nBeyond the tests added to `angular-mocksSpec.js`, I've also created JSFiddles with the new behaviour working alongside:\r\n\r\n- [Jasmine 2.x](https://jsfiddle.net/timruffles/h1u6hx6f/)\r\n- [Mocha](https://jsfiddle.net/timruffles/Lfkzhdca/)\r\n- [Jasmine 1.x](https://jsfiddle.net/timruffles/9299oxcx/) (to simply demonstrate it doesn't break anything - 1.x doesn't have beforeAll so can't use sharedInjector)\r\n\r\nThe verification tests above contain tests suggested by @lgalfaso. cc/@petebacondarwin. The unit tests added contain a little test framework stub, as it was nigh on impossible to test this feature without interference from the rest of the Angular test machinery. Testing inception!"},"comment":{"url":"https://api.github.com/repos/angular/angular.js/issues/comments/188384246","html_url":"https://github.com/angular/angular.js/pull/14093#issuecomment-188384246","issue_url":"https://api.github.com/repos/angular/angular.js/issues/14093","id":188384246,"user":{"login":"james-mcelwain","id":10366310,"avatar_url":"https://avatars.githubusercontent.com/u/10366310?v=3","gravatar_id":"","url":"https://api.github.com/users/james-mcelwain","html_url":"https://github.com/james-mcelwain","followers_url":"https://api.github.com/users/james-mcelwain/followers","following_url":"https://api.github.com/users/james-mcelwain/following{/other_user}","gists_url":"https://api.github.com/users/james-mcelwain/gists{/gist_id}","starred_url":"https://api.github.com/users/james-mcelwain/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/james-mcelwain/subscriptions","organizations_url":"https://api.github.com/users/james-mcelwain/orgs","repos_url":"https://api.github.com/users/james-mcelwain/repos","events_url":"https://api.github.com/users/james-mcelwain/events{/privacy}","received_events_url":"https://api.github.com/users/james-mcelwain/received_events","type":"User","site_admin":false},"created_at":"2016-02-24T18:01:48Z","updated_at":"2016-02-24T18:01:48Z","body":"Just ran into this bug today and am delighted to see the fix is in. Thanks @timruffles ! :+1: "}}