{"action":"created","comment":{"url":"https://api.github.com/repos/uberVU/mocha-mugshot-reporter/pulls/comments/39026453","id":39026453,"diff_hunk":"@@ -0,0 +1,67 @@\n+var expect = require('chai').expect,\n+    Mocha = require('mocha'),\n+    path = require('path')","path":"test/integration/test.js","position":3,"original_position":3,"commit_id":"dacff4432947bcf93bb1df4d930f1f64fe9928fc","original_commit_id":"dacff4432947bcf93bb1df4d930f1f64fe9928fc","user":{"login":"andrei-picus-hs","id":12442713,"avatar_url":"https://avatars.githubusercontent.com/u/12442713?v=3","gravatar_id":"","url":"https://api.github.com/users/andrei-picus-hs","html_url":"https://github.com/andrei-picus-hs","followers_url":"https://api.github.com/users/andrei-picus-hs/followers","following_url":"https://api.github.com/users/andrei-picus-hs/following{/other_user}","gists_url":"https://api.github.com/users/andrei-picus-hs/gists{/gist_id}","starred_url":"https://api.github.com/users/andrei-picus-hs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andrei-picus-hs/subscriptions","organizations_url":"https://api.github.com/users/andrei-picus-hs/orgs","repos_url":"https://api.github.com/users/andrei-picus-hs/repos","events_url":"https://api.github.com/users/andrei-picus-hs/events{/privacy}","received_events_url":"https://api.github.com/users/andrei-picus-hs/received_events","type":"User","site_admin":false},"body":"Missing semicolon.","created_at":"2015-09-09T10:12:51Z","updated_at":"2015-09-09T10:12:51Z","html_url":"https://github.com/uberVU/mocha-mugshot-reporter/pull/2#discussion_r39026453","pull_request_url":"https://api.github.com/repos/uberVU/mocha-mugshot-reporter/pulls/2","_links":{"self":{"href":"https://api.github.com/repos/uberVU/mocha-mugshot-reporter/pulls/comments/39026453"},"html":{"href":"https://github.com/uberVU/mocha-mugshot-reporter/pull/2#discussion_r39026453"},"pull_request":{"href":"https://api.github.com/repos/uberVU/mocha-mugshot-reporter/pulls/2"}}},"pull_request":{"url":"https://api.github.com/repos/uberVU/mocha-mugshot-reporter/pulls/2","id":44352484,"html_url":"https://github.com/uberVU/mocha-mugshot-reporter/pull/2","diff_url":"https://github.com/uberVU/mocha-mugshot-reporter/pull/2.diff","patch_url":"https://github.com/uberVU/mocha-mugshot-reporter/pull/2.patch","issue_url":"https://api.github.com/repos/uberVU/mocha-mugshot-reporter/issues/2","number":2,"state":"open","locked":false,"title":"Behave like Mocha core reporters","user":{"login":"flore77","id":11819686,"avatar_url":"https://avatars.githubusercontent.com/u/11819686?v=3","gravatar_id":"","url":"https://api.github.com/users/flore77","html_url":"https://github.com/flore77","followers_url":"https://api.github.com/users/flore77/followers","following_url":"https://api.github.com/users/flore77/following{/other_user}","gists_url":"https://api.github.com/users/flore77/gists{/gist_id}","starred_url":"https://api.github.com/users/flore77/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flore77/subscriptions","organizations_url":"https://api.github.com/users/flore77/orgs","repos_url":"https://api.github.com/users/flore77/repos","events_url":"https://api.github.com/users/flore77/events{/privacy}","received_events_url":"https://api.github.com/users/flore77/received_events","type":"User","site_admin":false},"body":"## Need\r\n\r\n```\r\nAs a developer\r\nI need to have a report to present it to my users\r\nSo that they will know what happens with their tests\r\n```\r\n\r\n## Deliverables\r\n\r\nOur reporter would behave like the required reporter. If no reporter is required, it would act like the [Spec](https://github.com/mochajs/mocha/blob/master/lib/reporters/spec.js) reporter (default).\r\n\r\n## Solution\r\n\r\nThe solution is to have `Mocha` as a dependency and require Mocha's reporters and instantiate the required reporter.\r\n\r\n```js\r\nvar reporters = require('mocha').reporters;\r\n\r\n// runner is passed by mocha to our reporter\r\nnew reporters.Spec(runner);\r\n```\r\n\r\nThe `default` can be changed by passing through mocha [reporter-options](https://mochajs.org/#usage), a key=value pair, which will be key: `reporter` and the value will be any `mocha core reporter`.\r\n\r\n```bash\r\nmocha file --reporter ourReporter --reporter-options reporter=nyan\r\n```\r\n\r\nFor testing, we should use [exec](http://devdocs.io/node/child_process#child_process_child_process_exec_command_options_callback) from the `child_process`,  like this:\r\n\r\n```js\r\nfunction getOutputs(reporter, done) {\r\n  // simple mocha\r\n  exec('mocha ' + file + ' --reporter=' + reporter, function(error, output, stderr) {\r\n    // mocha with our reporter\r\n    exec('mocha ' + file + ' --reporter=myReporter' + '--reporter-option reporter=' + reporter,\r\n      function(error, myOutput, stderr) {\r\n        done(output, myOutput);\r\n      });\r\n  });\r\n}\r\n```\r\n\r\n\r\nAnd to do the assertions: \r\n\r\n```js\r\ndescribe('description', function() {\r\n  // we will store the reporters here\r\n  var reporters = [] ;\r\n\r\n  reporters.forEach(function(reporter) {\r\n    it('should output the same with ' + reporter + ' reporter', function(done) {\r\n      getOutputs(reporter, function(output, myOutput) {\r\n        expect(output).to.be.deep.equal(myOutput);\r\n      \r\n        done();\r\n      });\r\n    });\r\n  });\r\n});\r\n```\r\n\r\n","created_at":"2015-09-07T12:55:43Z","updated_at":"2015-09-09T10:12:51Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7cb7b5dde3eac8d47d4c2fb9428cee1a80dcfb44","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/uberVU/mocha-mugshot-reporter/pulls/2/commits","review_comments_url":"https://api.github.com/repos/uberVU/mocha-mugshot-reporter/pulls/2/comments","review_comment_url":"https://api.github.com/repos/uberVU/mocha-mugshot-reporter/pulls/comments{/number}","comments_url":"https://api.github.com/repos/uberVU/mocha-mugshot-reporter/issues/2/comments","statuses_url":"https://api.github.com/repos/uberVU/mocha-mugshot-reporter/statuses/dacff4432947bcf93bb1df4d930f1f64fe9928fc","head":{"label":"uberVU:2-mocha-core-reporters","ref":"2-mocha-core-reporters","sha":"dacff4432947bcf93bb1df4d930f1f64fe9928fc","user":{"login":"uberVU","id":1199831,"avatar_url":"https://avatars.githubusercontent.com/u/1199831?v=3","gravatar_id":"","url":"https://api.github.com/users/uberVU","html_url":"https://github.com/uberVU","followers_url":"https://api.github.com/users/uberVU/followers","following_url":"https://api.github.com/users/uberVU/following{/other_user}","gists_url":"https://api.github.com/users/uberVU/gists{/gist_id}","starred_url":"https://api.github.com/users/uberVU/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/uberVU/subscriptions","organizations_url":"https://api.github.com/users/uberVU/orgs","repos_url":"https://api.github.com/users/uberVU/repos","events_url":"https://api.github.com/users/uberVU/events{/privacy}","received_events_url":"https://api.github.com/users/uberVU/received_events","type":"Organization","site_admin":false},"repo":{"id":41806986,"name":"mocha-mugshot-reporter","full_name":"uberVU/mocha-mugshot-reporter","owner":{"login":"uberVU","id":1199831,"avatar_url":"https://avatars.githubusercontent.com/u/1199831?v=3","gravatar_id":"","url":"https://api.github.com/users/uberVU","html_url":"https://github.com/uberVU","followers_url":"https://api.github.com/users/uberVU/followers","following_url":"https://api.github.com/users/uberVU/following{/other_user}","gists_url":"https://api.github.com/users/uberVU/gists{/gist_id}","starred_url":"https://api.github.com/users/uberVU/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/uberVU/subscriptions","organizations_url":"https://api.github.com/users/uberVU/orgs","repos_url":"https://api.github.com/users/uberVU/repos","events_url":"https://api.github.com/users/uberVU/events{/privacy}","received_events_url":"https://api.github.com/users/uberVU/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/uberVU/mocha-mugshot-reporter","description":"Mocha reporter for the Mugshot visual regression testing lib","fork":false,"url":"https://api.github.com/repos/uberVU/mocha-mugshot-reporter","forks_url":"https://api.github.com/repos/uberVU/mocha-mugshot-reporter/forks","keys_url":"https://api.github.com/repos/uberVU/mocha-mugshot-reporter/keys{/key_id}","collaborators_url":"https://api.github.com/repos/uberVU/mocha-mugshot-reporter/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/uberVU/mocha-mugshot-reporter/teams","hooks_url":"https://api.github.com/repos/uberVU/mocha-mugshot-reporter/hooks","issue_events_url":"https://api.github.com/repos/uberVU/mocha-mugshot-reporter/issues/events{/number}","events_url":"https://api.github.com/repos/uberVU/mocha-mugshot-reporter/events","assignees_url":"https://api.github.com/repos/uberVU/mocha-mugshot-reporter/assignees{/user}","branches_url":"https://api.github.com/repos/uberVU/mocha-mugshot-reporter/branches{/branch}","tags_url":"https://api.github.com/repos/uberVU/mocha-mugshot-reporter/tags","blobs_url":"https://api.github.com/repos/uberVU/mocha-mugshot-reporter/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/uberVU/mocha-mugshot-reporter/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/uberVU/mocha-mugshot-reporter/git/refs{/sha}","trees_url":"https://api.github.com/repos/uberVU/mocha-mugshot-reporter/git/trees{/sha}","statuses_url":"https://api.github.com/repos/uberVU/mocha-mugshot-reporter/statuses/{sha}","languages_url":"https://api.github.com/repos/uberVU/mocha-mugshot-reporter/languages","stargazers_url":"https://api.github.com/repos/uberVU/mocha-mugshot-reporter/stargazers","contributors_url":"https://api.github.com/repos/uberVU/mocha-mugshot-reporter/contributors","subscribers_url":"https://api.github.com/repos/uberVU/mocha-mugshot-reporter/subscribers","subscription_url":"https://api.github.com/repos/uberVU/mocha-mugshot-reporter/subscription","commits_url":"https://api.github.com/repos/uberVU/mocha-mugshot-reporter/commits{/sha}","git_commits_url":"https://api.github.com/repos/uberVU/mocha-mugshot-reporter/git/commits{/sha}","comments_url":"https://api.github.com/repos/uberVU/mocha-mugshot-reporter/comments{/number}","issue_comment_url":"https://api.github.com/repos/uberVU/mocha-mugshot-reporter/issues/comments{/number}","contents_url":"https://api.github.com/repos/uberVU/mocha-mugshot-reporter/contents/{+path}","compare_url":"https://api.github.com/repos/uberVU/mocha-mugshot-reporter/compare/{base}...{head}","merges_url":"https://api.github.com/repos/uberVU/mocha-mugshot-reporter/merges","archive_url":"https://api.github.com/repos/uberVU/mocha-mugshot-reporter/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/uberVU/mocha-mugshot-reporter/downloads","issues_url":"https://api.github.com/repos/uberVU/mocha-mugshot-reporter/issues{/number}","pulls_url":"https://api.github.com/repos/uberVU/mocha-mugshot-reporter/pulls{/number}","milestones_url":"https://api.github.com/repos/uberVU/mocha-mugshot-reporter/milestones{/number}","notifications_url":"https://api.github.com/repos/uberVU/mocha-mugshot-reporter/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/uberVU/mocha-mugshot-reporter/labels{/name}","releases_url":"https://api.github.com/repos/uberVU/mocha-mugshot-reporter/releases{/id}","created_at":"2015-09-02T14:46:08Z","updated_at":"2015-09-03T09:31:02Z","pushed_at":"2015-09-09T07:28:33Z","git_url":"git://github.com/uberVU/mocha-mugshot-reporter.git","ssh_url":"git@github.com:uberVU/mocha-mugshot-reporter.git","clone_url":"https://github.com/uberVU/mocha-mugshot-reporter.git","svn_url":"https://github.com/uberVU/mocha-mugshot-reporter","homepage":null,"size":0,"stargazers_count":1,"watchers_count":1,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":1,"default_branch":"master"}},"base":{"label":"uberVU:master","ref":"master","sha":"c6a821631a5d28dd828981a515f0d7453a2dc85b","user":{"login":"uberVU","id":1199831,"avatar_url":"https://avatars.githubusercontent.com/u/1199831?v=3","gravatar_id":"","url":"https://api.github.com/users/uberVU","html_url":"https://github.com/uberVU","followers_url":"https://api.github.com/users/uberVU/followers","following_url":"https://api.github.com/users/uberVU/following{/other_user}","gists_url":"https://api.github.com/users/uberVU/gists{/gist_id}","starred_url":"https://api.github.com/users/uberVU/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/uberVU/subscriptions","organizations_url":"https://api.github.com/users/uberVU/orgs","repos_url":"https://api.github.com/users/uberVU/repos","events_url":"https://api.github.com/users/uberVU/events{/privacy}","received_events_url":"https://api.github.com/users/uberVU/received_events","type":"Organization","site_admin":false},"repo":{"id":41806986,"name":"mocha-mugshot-reporter","full_name":"uberVU/mocha-mugshot-reporter","owner":{"login":"uberVU","id":1199831,"avatar_url":"https://avatars.githubusercontent.com/u/1199831?v=3","gravatar_id":"","url":"https://api.github.com/users/uberVU","html_url":"https://github.com/uberVU","followers_url":"https://api.github.com/users/uberVU/followers","following_url":"https://api.github.com/users/uberVU/following{/other_user}","gists_url":"https://api.github.com/users/uberVU/gists{/gist_id}","starred_url":"https://api.github.com/users/uberVU/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/uberVU/subscriptions","organizations_url":"https://api.github.com/users/uberVU/orgs","repos_url":"https://api.github.com/users/uberVU/repos","events_url":"https://api.github.com/users/uberVU/events{/privacy}","received_events_url":"https://api.github.com/users/uberVU/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/uberVU/mocha-mugshot-reporter","description":"Mocha reporter for the Mugshot visual regression testing lib","fork":false,"url":"https://api.github.com/repos/uberVU/mocha-mugshot-reporter","forks_url":"https://api.github.com/repos/uberVU/mocha-mugshot-reporter/forks","keys_url":"https://api.github.com/repos/uberVU/mocha-mugshot-reporter/keys{/key_id}","collaborators_url":"https://api.github.com/repos/uberVU/mocha-mugshot-reporter/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/uberVU/mocha-mugshot-reporter/teams","hooks_url":"https://api.github.com/repos/uberVU/mocha-mugshot-reporter/hooks","issue_events_url":"https://api.github.com/repos/uberVU/mocha-mugshot-reporter/issues/events{/number}","events_url":"https://api.github.com/repos/uberVU/mocha-mugshot-reporter/events","assignees_url":"https://api.github.com/repos/uberVU/mocha-mugshot-reporter/assignees{/user}","branches_url":"https://api.github.com/repos/uberVU/mocha-mugshot-reporter/branches{/branch}","tags_url":"https://api.github.com/repos/uberVU/mocha-mugshot-reporter/tags","blobs_url":"https://api.github.com/repos/uberVU/mocha-mugshot-reporter/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/uberVU/mocha-mugshot-reporter/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/uberVU/mocha-mugshot-reporter/git/refs{/sha}","trees_url":"https://api.github.com/repos/uberVU/mocha-mugshot-reporter/git/trees{/sha}","statuses_url":"https://api.github.com/repos/uberVU/mocha-mugshot-reporter/statuses/{sha}","languages_url":"https://api.github.com/repos/uberVU/mocha-mugshot-reporter/languages","stargazers_url":"https://api.github.com/repos/uberVU/mocha-mugshot-reporter/stargazers","contributors_url":"https://api.github.com/repos/uberVU/mocha-mugshot-reporter/contributors","subscribers_url":"https://api.github.com/repos/uberVU/mocha-mugshot-reporter/subscribers","subscription_url":"https://api.github.com/repos/uberVU/mocha-mugshot-reporter/subscription","commits_url":"https://api.github.com/repos/uberVU/mocha-mugshot-reporter/commits{/sha}","git_commits_url":"https://api.github.com/repos/uberVU/mocha-mugshot-reporter/git/commits{/sha}","comments_url":"https://api.github.com/repos/uberVU/mocha-mugshot-reporter/comments{/number}","issue_comment_url":"https://api.github.com/repos/uberVU/mocha-mugshot-reporter/issues/comments{/number}","contents_url":"https://api.github.com/repos/uberVU/mocha-mugshot-reporter/contents/{+path}","compare_url":"https://api.github.com/repos/uberVU/mocha-mugshot-reporter/compare/{base}...{head}","merges_url":"https://api.github.com/repos/uberVU/mocha-mugshot-reporter/merges","archive_url":"https://api.github.com/repos/uberVU/mocha-mugshot-reporter/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/uberVU/mocha-mugshot-reporter/downloads","issues_url":"https://api.github.com/repos/uberVU/mocha-mugshot-reporter/issues{/number}","pulls_url":"https://api.github.com/repos/uberVU/mocha-mugshot-reporter/pulls{/number}","milestones_url":"https://api.github.com/repos/uberVU/mocha-mugshot-reporter/milestones{/number}","notifications_url":"https://api.github.com/repos/uberVU/mocha-mugshot-reporter/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/uberVU/mocha-mugshot-reporter/labels{/name}","releases_url":"https://api.github.com/repos/uberVU/mocha-mugshot-reporter/releases{/id}","created_at":"2015-09-02T14:46:08Z","updated_at":"2015-09-03T09:31:02Z","pushed_at":"2015-09-09T07:28:33Z","git_url":"git://github.com/uberVU/mocha-mugshot-reporter.git","ssh_url":"git@github.com:uberVU/mocha-mugshot-reporter.git","clone_url":"https://github.com/uberVU/mocha-mugshot-reporter.git","svn_url":"https://github.com/uberVU/mocha-mugshot-reporter","homepage":null,"size":0,"stargazers_count":1,"watchers_count":1,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/uberVU/mocha-mugshot-reporter/pulls/2"},"html":{"href":"https://github.com/uberVU/mocha-mugshot-reporter/pull/2"},"issue":{"href":"https://api.github.com/repos/uberVU/mocha-mugshot-reporter/issues/2"},"comments":{"href":"https://api.github.com/repos/uberVU/mocha-mugshot-reporter/issues/2/comments"},"review_comments":{"href":"https://api.github.com/repos/uberVU/mocha-mugshot-reporter/pulls/2/comments"},"review_comment":{"href":"https://api.github.com/repos/uberVU/mocha-mugshot-reporter/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/uberVU/mocha-mugshot-reporter/pulls/2/commits"},"statuses":{"href":"https://api.github.com/repos/uberVU/mocha-mugshot-reporter/statuses/dacff4432947bcf93bb1df4d930f1f64fe9928fc"}}}}