{"action":"created","issue":{"url":"https://api.github.com/repos/jasmine/jasmine-ajax/issues/150","repository_url":"https://api.github.com/repos/jasmine/jasmine-ajax","labels_url":"https://api.github.com/repos/jasmine/jasmine-ajax/issues/150/labels{/name}","comments_url":"https://api.github.com/repos/jasmine/jasmine-ajax/issues/150/comments","events_url":"https://api.github.com/repos/jasmine/jasmine-ajax/issues/150/events","html_url":"https://github.com/jasmine/jasmine-ajax/pull/150","id":140547506,"number":150,"title":"Check for a global jasmine and use it if found.","user":{"login":"kring","id":924374,"avatar_url":"https://avatars.githubusercontent.com/u/924374?v=3","gravatar_id":"","url":"https://api.github.com/users/kring","html_url":"https://github.com/kring","followers_url":"https://api.github.com/users/kring/followers","following_url":"https://api.github.com/users/kring/following{/other_user}","gists_url":"https://api.github.com/users/kring/gists{/gist_id}","starred_url":"https://api.github.com/users/kring/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kring/subscriptions","organizations_url":"https://api.github.com/users/kring/orgs","repos_url":"https://api.github.com/users/kring/repos","events_url":"https://api.github.com/users/kring/events{/privacy}","received_events_url":"https://api.github.com/users/kring/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2016-03-14T00:35:38Z","updated_at":"2016-03-17T00:35:40Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/jasmine/jasmine-ajax/pulls/150","html_url":"https://github.com/jasmine/jasmine-ajax/pull/150","diff_url":"https://github.com/jasmine/jasmine-ajax/pull/150.diff","patch_url":"https://github.com/jasmine/jasmine-ajax/pull/150.patch"},"body":"This makes jasmine-ajax work with Browserify.  Browserify is a CommonJS environment, but it runs in a browser and doesn't play nicely with `jasmine-core` (or at least I had trouble using it in my project).  The way we use Jasmine - and I suspect this isn't uncommon - is we include Jasmine and our Browserify-built bundle using regular script tags.  So `jasmine` is global and requiring-in `jasmine-core` is incorrect, even though we are in a CommonJS environment.\r\n\r\nThis change only checks whether a global `jasmine` is defined.  A slightly more defensive approach - but perhaps overkill? - would be to also check for particular properties on that `jasmine` object.  i.e.: make sure it's the right jasmine."},"comment":{"url":"https://api.github.com/repos/jasmine/jasmine-ajax/issues/comments/197622808","html_url":"https://github.com/jasmine/jasmine-ajax/pull/150#issuecomment-197622808","issue_url":"https://api.github.com/repos/jasmine/jasmine-ajax/issues/150","id":197622808,"user":{"login":"kring","id":924374,"avatar_url":"https://avatars.githubusercontent.com/u/924374?v=3","gravatar_id":"","url":"https://api.github.com/users/kring","html_url":"https://github.com/kring","followers_url":"https://api.github.com/users/kring/followers","following_url":"https://api.github.com/users/kring/following{/other_user}","gists_url":"https://api.github.com/users/kring/gists{/gist_id}","starred_url":"https://api.github.com/users/kring/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kring/subscriptions","organizations_url":"https://api.github.com/users/kring/orgs","repos_url":"https://api.github.com/users/kring/repos","events_url":"https://api.github.com/users/kring/events{/privacy}","received_events_url":"https://api.github.com/users/kring/received_events","type":"User","site_admin":false},"created_at":"2016-03-17T00:35:40Z","updated_at":"2016-03-17T00:35:40Z","body":"Are you sure you _don't_ have that problem without this pull request?  Because I think that this change will make it so that require is never actually executed at runtime.  However, Webpack (both with and without this PR) will see the `require('jasmine-core')` and bundle it in for you, because it doesn't know any better.\r\n\r\nWe're actually in the process of switching from Browserify to Webpack, so I ran into this same problem the other day.  My solution was to add code like this to `webpack.config.js`:\r\n\r\n```\r\nmodule: {\r\n        loaders: [\r\n            {\r\n                // Don't let jasmine-ajax detect require and import jasmine-core, because we bring\r\n                // in Jasmine via a script tag instead.\r\n                test: require.resolve('jasmine-ajax'),\r\n                loader: 'imports?require=>false'\r\n            }\r\n        ]\r\n    }\r\n```"}}