{"action":"created","comment":{"url":"https://api.github.com/repos/ably/ably-js/pulls/comments/51102830","id":51102830,"diff_hunk":"@@ -0,0 +1,139 @@\n+\"use strict\";\n+\n+define(['shared_helper'], function(helper) {\n+\tvar exports = {};\n+\n+\tvar isBrowser = !!(typeof window !== 'undefined' && typeof navigator !== 'undefined' && window.document);\n+\n+\t/* If we are running node, we mimic the loading mechanism used in /nodejs/realtime.js and /nodejs/rest.js\n+\t * to get a reference to the logger. We do this because its implementation is not a module.\n+\t * \n+\t * If we are in a browser, the logger is already loaded manually via a script tag in nodeunit.html.\n+\t */\n+\n+\tvar logger;\n+\t\n+\tif (isBrowser) {\n+\t\tlogger = Logger;\n+\t} else {\n+\n+\t\tvar\n+\t\t\tfs   = require('fs'),","path":"spec/rest/logger.test.js","position":null,"original_position":21,"commit_id":"b9706436d905549341ffb58ddab403ab4097d0ed","original_commit_id":"60c075824c620a655c0624970ff97bbcc6c46905","user":{"login":"mattheworiordan","id":43789,"avatar_url":"https://avatars.githubusercontent.com/u/43789?v=3","gravatar_id":"","url":"https://api.github.com/users/mattheworiordan","html_url":"https://github.com/mattheworiordan","followers_url":"https://api.github.com/users/mattheworiordan/followers","following_url":"https://api.github.com/users/mattheworiordan/following{/other_user}","gists_url":"https://api.github.com/users/mattheworiordan/gists{/gist_id}","starred_url":"https://api.github.com/users/mattheworiordan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattheworiordan/subscriptions","organizations_url":"https://api.github.com/users/mattheworiordan/orgs","repos_url":"https://api.github.com/users/mattheworiordan/repos","events_url":"https://api.github.com/users/mattheworiordan/events{/privacy}","received_events_url":"https://api.github.com/users/mattheworiordan/received_events","type":"User","site_admin":false},"body":"In this repo, we should be using tabs.  Feel free to issue a separate PR to correct the space issues if you find them","created_at":"2016-01-28T10:13:42Z","updated_at":"2016-01-28T10:13:42Z","html_url":"https://github.com/ably/ably-js/pull/216#discussion_r51102830","pull_request_url":"https://api.github.com/repos/ably/ably-js/pulls/216","_links":{"self":{"href":"https://api.github.com/repos/ably/ably-js/pulls/comments/51102830"},"html":{"href":"https://github.com/ably/ably-js/pull/216#discussion_r51102830"},"pull_request":{"href":"https://api.github.com/repos/ably/ably-js/pulls/216"}}},"pull_request":{"url":"https://api.github.com/repos/ably/ably-js/pulls/216","id":57083752,"html_url":"https://github.com/ably/ably-js/pull/216","diff_url":"https://github.com/ably/ably-js/pull/216.diff","patch_url":"https://github.com/ably/ably-js/pull/216.patch","issue_url":"https://api.github.com/repos/ably/ably-js/issues/216","number":216,"state":"open","locked":false,"title":"RSC2,3,4 logger test","user":{"login":"alex-georgiou","id":2937881,"avatar_url":"https://avatars.githubusercontent.com/u/2937881?v=3","gravatar_id":"","url":"https://api.github.com/users/alex-georgiou","html_url":"https://github.com/alex-georgiou","followers_url":"https://api.github.com/users/alex-georgiou/followers","following_url":"https://api.github.com/users/alex-georgiou/following{/other_user}","gists_url":"https://api.github.com/users/alex-georgiou/gists{/gist_id}","starred_url":"https://api.github.com/users/alex-georgiou/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alex-georgiou/subscriptions","organizations_url":"https://api.github.com/users/alex-georgiou/orgs","repos_url":"https://api.github.com/users/alex-georgiou/repos","events_url":"https://api.github.com/users/alex-georgiou/events{/privacy}","received_events_url":"https://api.github.com/users/alex-georgiou/received_events","type":"User","site_admin":false},"body":"This is a proposed solution for testing the Logger (RSC2, RSC3, RSC4).\r\n\r\nThe difficulty here is that the logger is not defined to be a module, and thus cannot be `require`d. Also the logger is unavailable outside the library's context due to closure, so tests cannot reach it.\r\n\r\nA new script tag is added in `nodeunit.html`. This ensures that the Logger is loaded in a global context. This solution has the drawback that it pollutes our global namespace, but only for our tests, which shouldn't be a big problem.\r\n\r\nI have exposed the entire `/common/lib/util` dir to the express webserver rather than just the logger file, because in the future we might want to test the other util/* files, which are also not modules.\r\n\r\nIf exposing these files to the webserver is not acceptable for whatever reason, another idea would be to use something like `grunt-preprocess` to conditionally expose the logger to the tests only if the environment is a test environment. IMO this is an even less pretty solution, and also seems more hacky and error-prone.\r\n\r\nIf we are running node, I mimic the mechanism used in the library to load the logger. Again this is done because we cannot require something that is not a module.\r\n\r\nA possible issue with these tests is that they lack isolation. This can be fixed by loading the logger again and again, or perhaps with some other mechanism that clones the logger, such as `Object.create(Logger)`. The problem here is that the Logger is not being instantiated via a constructor. Let me know if you'd like me to look more into this issue.","created_at":"2016-01-25T15:15:23Z","updated_at":"2016-01-28T10:13:43Z","closed_at":null,"merged_at":null,"merge_commit_sha":"71d25484a2160dd14531907a23fed6b151227351","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ably/ably-js/pulls/216/commits","review_comments_url":"https://api.github.com/repos/ably/ably-js/pulls/216/comments","review_comment_url":"https://api.github.com/repos/ably/ably-js/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ably/ably-js/issues/216/comments","statuses_url":"https://api.github.com/repos/ably/ably-js/statuses/b9706436d905549341ffb58ddab403ab4097d0ed","head":{"label":"alex-georgiou:RSC2,3,4-logger-test","ref":"RSC2,3,4-logger-test","sha":"b9706436d905549341ffb58ddab403ab4097d0ed","user":{"login":"alex-georgiou","id":2937881,"avatar_url":"https://avatars.githubusercontent.com/u/2937881?v=3","gravatar_id":"","url":"https://api.github.com/users/alex-georgiou","html_url":"https://github.com/alex-georgiou","followers_url":"https://api.github.com/users/alex-georgiou/followers","following_url":"https://api.github.com/users/alex-georgiou/following{/other_user}","gists_url":"https://api.github.com/users/alex-georgiou/gists{/gist_id}","starred_url":"https://api.github.com/users/alex-georgiou/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alex-georgiou/subscriptions","organizations_url":"https://api.github.com/users/alex-georgiou/orgs","repos_url":"https://api.github.com/users/alex-georgiou/repos","events_url":"https://api.github.com/users/alex-georgiou/events{/privacy}","received_events_url":"https://api.github.com/users/alex-georgiou/received_events","type":"User","site_admin":false},"repo":{"id":50049111,"name":"ably-js","full_name":"alex-georgiou/ably-js","owner":{"login":"alex-georgiou","id":2937881,"avatar_url":"https://avatars.githubusercontent.com/u/2937881?v=3","gravatar_id":"","url":"https://api.github.com/users/alex-georgiou","html_url":"https://github.com/alex-georgiou","followers_url":"https://api.github.com/users/alex-georgiou/followers","following_url":"https://api.github.com/users/alex-georgiou/following{/other_user}","gists_url":"https://api.github.com/users/alex-georgiou/gists{/gist_id}","starred_url":"https://api.github.com/users/alex-georgiou/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alex-georgiou/subscriptions","organizations_url":"https://api.github.com/users/alex-georgiou/orgs","repos_url":"https://api.github.com/users/alex-georgiou/repos","events_url":"https://api.github.com/users/alex-georgiou/events{/privacy}","received_events_url":"https://api.github.com/users/alex-georgiou/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/alex-georgiou/ably-js","description":"Ably Realtime Messaging Javascript library to connect from your browser or Node.js","fork":true,"url":"https://api.github.com/repos/alex-georgiou/ably-js","forks_url":"https://api.github.com/repos/alex-georgiou/ably-js/forks","keys_url":"https://api.github.com/repos/alex-georgiou/ably-js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/alex-georgiou/ably-js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/alex-georgiou/ably-js/teams","hooks_url":"https://api.github.com/repos/alex-georgiou/ably-js/hooks","issue_events_url":"https://api.github.com/repos/alex-georgiou/ably-js/issues/events{/number}","events_url":"https://api.github.com/repos/alex-georgiou/ably-js/events","assignees_url":"https://api.github.com/repos/alex-georgiou/ably-js/assignees{/user}","branches_url":"https://api.github.com/repos/alex-georgiou/ably-js/branches{/branch}","tags_url":"https://api.github.com/repos/alex-georgiou/ably-js/tags","blobs_url":"https://api.github.com/repos/alex-georgiou/ably-js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/alex-georgiou/ably-js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/alex-georgiou/ably-js/git/refs{/sha}","trees_url":"https://api.github.com/repos/alex-georgiou/ably-js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/alex-georgiou/ably-js/statuses/{sha}","languages_url":"https://api.github.com/repos/alex-georgiou/ably-js/languages","stargazers_url":"https://api.github.com/repos/alex-georgiou/ably-js/stargazers","contributors_url":"https://api.github.com/repos/alex-georgiou/ably-js/contributors","subscribers_url":"https://api.github.com/repos/alex-georgiou/ably-js/subscribers","subscription_url":"https://api.github.com/repos/alex-georgiou/ably-js/subscription","commits_url":"https://api.github.com/repos/alex-georgiou/ably-js/commits{/sha}","git_commits_url":"https://api.github.com/repos/alex-georgiou/ably-js/git/commits{/sha}","comments_url":"https://api.github.com/repos/alex-georgiou/ably-js/comments{/number}","issue_comment_url":"https://api.github.com/repos/alex-georgiou/ably-js/issues/comments{/number}","contents_url":"https://api.github.com/repos/alex-georgiou/ably-js/contents/{+path}","compare_url":"https://api.github.com/repos/alex-georgiou/ably-js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/alex-georgiou/ably-js/merges","archive_url":"https://api.github.com/repos/alex-georgiou/ably-js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/alex-georgiou/ably-js/downloads","issues_url":"https://api.github.com/repos/alex-georgiou/ably-js/issues{/number}","pulls_url":"https://api.github.com/repos/alex-georgiou/ably-js/pulls{/number}","milestones_url":"https://api.github.com/repos/alex-georgiou/ably-js/milestones{/number}","notifications_url":"https://api.github.com/repos/alex-georgiou/ably-js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/alex-georgiou/ably-js/labels{/name}","releases_url":"https://api.github.com/repos/alex-georgiou/ably-js/releases{/id}","deployments_url":"https://api.github.com/repos/alex-georgiou/ably-js/deployments","created_at":"2016-01-20T18:00:33Z","updated_at":"2016-01-20T18:00:35Z","pushed_at":"2016-01-28T09:13:59Z","git_url":"git://github.com/alex-georgiou/ably-js.git","ssh_url":"git@github.com:alex-georgiou/ably-js.git","clone_url":"https://github.com/alex-georgiou/ably-js.git","svn_url":"https://github.com/alex-georgiou/ably-js","homepage":null,"size":11910,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","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":"ably:master","ref":"master","sha":"a32b34a92651c1d0154714b8cca888d75537443f","user":{"login":"ably","id":1859245,"avatar_url":"https://avatars.githubusercontent.com/u/1859245?v=3","gravatar_id":"","url":"https://api.github.com/users/ably","html_url":"https://github.com/ably","followers_url":"https://api.github.com/users/ably/followers","following_url":"https://api.github.com/users/ably/following{/other_user}","gists_url":"https://api.github.com/users/ably/gists{/gist_id}","starred_url":"https://api.github.com/users/ably/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ably/subscriptions","organizations_url":"https://api.github.com/users/ably/orgs","repos_url":"https://api.github.com/users/ably/repos","events_url":"https://api.github.com/users/ably/events{/privacy}","received_events_url":"https://api.github.com/users/ably/received_events","type":"Organization","site_admin":false},"repo":{"id":6676523,"name":"ably-js","full_name":"ably/ably-js","owner":{"login":"ably","id":1859245,"avatar_url":"https://avatars.githubusercontent.com/u/1859245?v=3","gravatar_id":"","url":"https://api.github.com/users/ably","html_url":"https://github.com/ably","followers_url":"https://api.github.com/users/ably/followers","following_url":"https://api.github.com/users/ably/following{/other_user}","gists_url":"https://api.github.com/users/ably/gists{/gist_id}","starred_url":"https://api.github.com/users/ably/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ably/subscriptions","organizations_url":"https://api.github.com/users/ably/orgs","repos_url":"https://api.github.com/users/ably/repos","events_url":"https://api.github.com/users/ably/events{/privacy}","received_events_url":"https://api.github.com/users/ably/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ably/ably-js","description":"Ably Realtime Messaging Javascript library to connect from your browser or Node.js","fork":false,"url":"https://api.github.com/repos/ably/ably-js","forks_url":"https://api.github.com/repos/ably/ably-js/forks","keys_url":"https://api.github.com/repos/ably/ably-js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ably/ably-js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ably/ably-js/teams","hooks_url":"https://api.github.com/repos/ably/ably-js/hooks","issue_events_url":"https://api.github.com/repos/ably/ably-js/issues/events{/number}","events_url":"https://api.github.com/repos/ably/ably-js/events","assignees_url":"https://api.github.com/repos/ably/ably-js/assignees{/user}","branches_url":"https://api.github.com/repos/ably/ably-js/branches{/branch}","tags_url":"https://api.github.com/repos/ably/ably-js/tags","blobs_url":"https://api.github.com/repos/ably/ably-js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ably/ably-js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ably/ably-js/git/refs{/sha}","trees_url":"https://api.github.com/repos/ably/ably-js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ably/ably-js/statuses/{sha}","languages_url":"https://api.github.com/repos/ably/ably-js/languages","stargazers_url":"https://api.github.com/repos/ably/ably-js/stargazers","contributors_url":"https://api.github.com/repos/ably/ably-js/contributors","subscribers_url":"https://api.github.com/repos/ably/ably-js/subscribers","subscription_url":"https://api.github.com/repos/ably/ably-js/subscription","commits_url":"https://api.github.com/repos/ably/ably-js/commits{/sha}","git_commits_url":"https://api.github.com/repos/ably/ably-js/git/commits{/sha}","comments_url":"https://api.github.com/repos/ably/ably-js/comments{/number}","issue_comment_url":"https://api.github.com/repos/ably/ably-js/issues/comments{/number}","contents_url":"https://api.github.com/repos/ably/ably-js/contents/{+path}","compare_url":"https://api.github.com/repos/ably/ably-js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ably/ably-js/merges","archive_url":"https://api.github.com/repos/ably/ably-js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ably/ably-js/downloads","issues_url":"https://api.github.com/repos/ably/ably-js/issues{/number}","pulls_url":"https://api.github.com/repos/ably/ably-js/pulls{/number}","milestones_url":"https://api.github.com/repos/ably/ably-js/milestones{/number}","notifications_url":"https://api.github.com/repos/ably/ably-js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ably/ably-js/labels{/name}","releases_url":"https://api.github.com/repos/ably/ably-js/releases{/id}","deployments_url":"https://api.github.com/repos/ably/ably-js/deployments","created_at":"2012-11-13T19:41:13Z","updated_at":"2016-01-24T15:57:03Z","pushed_at":"2016-01-28T09:13:59Z","git_url":"git://github.com/ably/ably-js.git","ssh_url":"git@github.com:ably/ably-js.git","clone_url":"https://github.com/ably/ably-js.git","svn_url":"https://github.com/ably/ably-js","homepage":null,"size":12053,"stargazers_count":5,"watchers_count":5,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":36,"forks":3,"open_issues":36,"watchers":5,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ably/ably-js/pulls/216"},"html":{"href":"https://github.com/ably/ably-js/pull/216"},"issue":{"href":"https://api.github.com/repos/ably/ably-js/issues/216"},"comments":{"href":"https://api.github.com/repos/ably/ably-js/issues/216/comments"},"review_comments":{"href":"https://api.github.com/repos/ably/ably-js/pulls/216/comments"},"review_comment":{"href":"https://api.github.com/repos/ably/ably-js/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ably/ably-js/pulls/216/commits"},"statuses":{"href":"https://api.github.com/repos/ably/ably-js/statuses/b9706436d905549341ffb58ddab403ab4097d0ed"}}}}