GitHub PullRequestReviewCommentEvent at 2014-11-18 06:01:40
Repository: mocha
Actor: boneskull
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/mochajs/mocha/pulls/comments/20487102","id":20487102,"diff_hunk":"@@ -34,9 +40,22 @@ function Markdown(runner) {\n     return Array(level).join('  ');\n   }\n \n+  function addPrefix(str) {\n+    if (typeof str == \"string\" && str.length > 0)\n+      return SUITE_PREFIX + str;\n+    return str;\n+  }\n+\n+  function delPrefix(str) {\n+    if (str.indexOf(SUITE_PREFIX) == 0)\n+      return str.slice(SUITE_PREFIX.length);\n+    return str;\n+  }\n+\n   function mapTOC(suite, obj) {\n-    var ret = obj;\n-    obj = obj[suite.title] = obj[suite.title] || { suite: suite };\n+    var ret = obj,\n+        key = addPrefix(suite.title);\n+    obj = obj[key] = obj[key] || { suite: suite };","path":"lib/reporters/markdown.js","position":34,"original_position":34,"commit_id":"c7cf3ea729f73d3fc07f672dbe44ede5d41512d5","original_commit_id":"c7cf3ea729f73d3fc07f672dbe44ede5d41512d5","user":{"login":"boneskull","id":924465,"avatar_url":"https://avatars.githubusercontent.com/u/924465?v=3","gravatar_id":"","url":"https://api.github.com/users/boneskull","html_url":"https://github.com/boneskull","followers_url":"https://api.github.com/users/boneskull/followers","following_url":"https://api.github.com/users/boneskull/following{/other_user}","gists_url":"https://api.github.com/users/boneskull/gists{/gist_id}","starred_url":"https://api.github.com/users/boneskull/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/boneskull/subscriptions","organizations_url":"https://api.github.com/users/boneskull/orgs","repos_url":"https://api.github.com/users/boneskull/repos","events_url":"https://api.github.com/users/boneskull/events{/privacy}","received_events_url":"https://api.github.com/users/boneskull/received_events","type":"User","site_admin":false},"body":"Let's simplify.\r\n\r\nThe prefix can be `$`.\r\n\r\nSuite titles must be primitives, right?\r\n\r\n*Always* add the prefix:\r\n\r\n```js\r\nvar SUITE_PREFIX = '$';\r\nvar key = SUITE_PREFIX + suite.title;\r\nobj = obj[key] = obj[key] || { suite: suite };\r\n```\r\n\r\nThen, later, just toss it out:\r\n\r\n```js\r\nif (key) {\r\n  link = ' - [' + key.substring(1) + '](#' + utils.slug(obj[key].suite.fullTitle()) + ')\\n';\r\n  buf += Array(level).join('  ') + link;\r\n} \r\n```\r\n\r\nPlease use parens in blocks, even if you don't see them in the code.","created_at":"2014-11-18T06:01:40Z","updated_at":"2014-11-18T06:01:40Z","html_url":"https://github.com/mochajs/mocha/pull/1427#discussion_r20487102","pull_request_url":"https://api.github.com/repos/mochajs/mocha/pulls/1427","_links":{"self":{"href":"https://api.github.com/repos/mochajs/mocha/pulls/comments/20487102"},"html":{"href":"https://github.com/mochajs/mocha/pull/1427#discussion_r20487102"},"pull_request":{"href":"https://api.github.com/repos/mochajs/mocha/pulls/1427"}}},"pull_request":{"url":"https://api.github.com/repos/mochajs/mocha/pulls/1427","id":24225982,"html_url":"https://github.com/mochajs/mocha/pull/1427","diff_url":"https://github.com/mochajs/mocha/pull/1427.diff","patch_url":"https://github.com/mochajs/mocha/pull/1427.patch","issue_url":"https://api.github.com/repos/mochajs/mocha/issues/1427","number":1427,"state":"open","locked":false,"title":"prefix/namespace for suite titles in markdown reporter, fixes #554","user":{"login":"dasilvacontin","id":1260830,"avatar_url":"https://avatars.githubusercontent.com/u/1260830?v=3","gravatar_id":"","url":"https://api.github.com/users/dasilvacontin","html_url":"https://github.com/dasilvacontin","followers_url":"https://api.github.com/users/dasilvacontin/followers","following_url":"https://api.github.com/users/dasilvacontin/following{/other_user}","gists_url":"https://api.github.com/users/dasilvacontin/gists{/gist_id}","starred_url":"https://api.github.com/users/dasilvacontin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dasilvacontin/subscriptions","organizations_url":"https://api.github.com/users/dasilvacontin/orgs","repos_url":"https://api.github.com/users/dasilvacontin/repos","events_url":"https://api.github.com/users/dasilvacontin/events{/privacy}","received_events_url":"https://api.github.com/users/dasilvacontin/received_events","type":"User","site_admin":false},"body":"When using the markdown reporter, using reserved keywords as suite titles yielded unexpected behaviour at best.","created_at":"2014-11-11T15:22:54Z","updated_at":"2014-11-18T06:01:40Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3c9f90783aa27ca7e9443c8891a160a845b26833","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mochajs/mocha/pulls/1427/commits","review_comments_url":"https://api.github.com/repos/mochajs/mocha/pulls/1427/comments","review_comment_url":"https://api.github.com/repos/mochajs/mocha/pulls/comments/{number}","comments_url":"https://api.github.com/repos/mochajs/mocha/issues/1427/comments","statuses_url":"https://api.github.com/repos/mochajs/mocha/statuses/c7cf3ea729f73d3fc07f672dbe44ede5d41512d5","head":{"label":"dasilvacontin:issue/554","ref":"issue/554","sha":"c7cf3ea729f73d3fc07f672dbe44ede5d41512d5","user":{"login":"dasilvacontin","id":1260830,"avatar_url":"https://avatars.githubusercontent.com/u/1260830?v=3","gravatar_id":"","url":"https://api.github.com/users/dasilvacontin","html_url":"https://github.com/dasilvacontin","followers_url":"https://api.github.com/users/dasilvacontin/followers","following_url":"https://api.github.com/users/dasilvacontin/following{/other_user}","gists_url":"https://api.github.com/users/dasilvacontin/gists{/gist_id}","starred_url":"https://api.github.com/users/dasilvacontin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dasilvacontin/subscriptions","organizations_url":"https://api.github.com/users/dasilvacontin/orgs","repos_url":"https://api.github.com/users/dasilvacontin/repos","events_url":"https://api.github.com/users/dasilvacontin/events{/privacy}","received_events_url":"https://api.github.com/users/dasilvacontin/received_events","type":"User","site_admin":false},"repo":{"id":24950710,"name":"mocha","full_name":"dasilvacontin/mocha","owner":{"login":"dasilvacontin","id":1260830,"avatar_url":"https://avatars.githubusercontent.com/u/1260830?v=3","gravatar_id":"","url":"https://api.github.com/users/dasilvacontin","html_url":"https://github.com/dasilvacontin","followers_url":"https://api.github.com/users/dasilvacontin/followers","following_url":"https://api.github.com/users/dasilvacontin/following{/other_user}","gists_url":"https://api.github.com/users/dasilvacontin/gists{/gist_id}","starred_url":"https://api.github.com/users/dasilvacontin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dasilvacontin/subscriptions","organizations_url":"https://api.github.com/users/dasilvacontin/orgs","repos_url":"https://api.github.com/users/dasilvacontin/repos","events_url":"https://api.github.com/users/dasilvacontin/events{/privacy}","received_events_url":"https://api.github.com/users/dasilvacontin/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dasilvacontin/mocha","description":"mocha - simple, flexible, fun javascript test framework for node.js & the browser. (BDD, TDD, QUnit styles via interfaces)","fork":true,"url":"https://api.github.com/repos/dasilvacontin/mocha","forks_url":"https://api.github.com/repos/dasilvacontin/mocha/forks","keys_url":"https://api.github.com/repos/dasilvacontin/mocha/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dasilvacontin/mocha/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dasilvacontin/mocha/teams","hooks_url":"https://api.github.com/repos/dasilvacontin/mocha/hooks","issue_events_url":"https://api.github.com/repos/dasilvacontin/mocha/issues/events{/number}","events_url":"https://api.github.com/repos/dasilvacontin/mocha/events","assignees_url":"https://api.github.com/repos/dasilvacontin/mocha/assignees{/user}","branches_url":"https://api.github.com/repos/dasilvacontin/mocha/branches{/branch}","tags_url":"https://api.github.com/repos/dasilvacontin/mocha/tags","blobs_url":"https://api.github.com/repos/dasilvacontin/mocha/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dasilvacontin/mocha/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dasilvacontin/mocha/git/refs{/sha}","trees_url":"https://api.github.com/repos/dasilvacontin/mocha/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dasilvacontin/mocha/statuses/{sha}","languages_url":"https://api.github.com/repos/dasilvacontin/mocha/languages","stargazers_url":"https://api.github.com/repos/dasilvacontin/mocha/stargazers","contributors_url":"https://api.github.com/repos/dasilvacontin/mocha/contributors","subscribers_url":"https://api.github.com/repos/dasilvacontin/mocha/subscribers","subscription_url":"https://api.github.com/repos/dasilvacontin/mocha/subscription","commits_url":"https://api.github.com/repos/dasilvacontin/mocha/commits{/sha}","git_commits_url":"https://api.github.com/repos/dasilvacontin/mocha/git/commits{/sha}","comments_url":"https://api.github.com/repos/dasilvacontin/mocha/comments{/number}","issue_comment_url":"https://api.github.com/repos/dasilvacontin/mocha/issues/comments/{number}","contents_url":"https://api.github.com/repos/dasilvacontin/mocha/contents/{+path}","compare_url":"https://api.github.com/repos/dasilvacontin/mocha/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dasilvacontin/mocha/merges","archive_url":"https://api.github.com/repos/dasilvacontin/mocha/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dasilvacontin/mocha/downloads","issues_url":"https://api.github.com/repos/dasilvacontin/mocha/issues{/number}","pulls_url":"https://api.github.com/repos/dasilvacontin/mocha/pulls{/number}","milestones_url":"https://api.github.com/repos/dasilvacontin/mocha/milestones{/number}","notifications_url":"https://api.github.com/repos/dasilvacontin/mocha/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dasilvacontin/mocha/labels{/name}","releases_url":"https://api.github.com/repos/dasilvacontin/mocha/releases{/id}","created_at":"2014-10-08T16:53:37Z","updated_at":"2014-10-08T17:02:28Z","pushed_at":"2014-11-11T15:20:02Z","git_url":"git://github.com/dasilvacontin/mocha.git","ssh_url":"git@github.com:dasilvacontin/mocha.git","clone_url":"https://github.com/dasilvacontin/mocha.git","svn_url":"https://github.com/dasilvacontin/mocha","homepage":"http://visionmedia.github.com/mocha","size":4817,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"mochajs:master","ref":"master","sha":"7ddc5da4a7a76c8ae7d2e8b42dae03e0c3932117","user":{"login":"mochajs","id":8770005,"avatar_url":"https://avatars.githubusercontent.com/u/8770005?v=3","gravatar_id":"","url":"https://api.github.com/users/mochajs","html_url":"https://github.com/mochajs","followers_url":"https://api.github.com/users/mochajs/followers","following_url":"https://api.github.com/users/mochajs/following{/other_user}","gists_url":"https://api.github.com/users/mochajs/gists{/gist_id}","starred_url":"https://api.github.com/users/mochajs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mochajs/subscriptions","organizations_url":"https://api.github.com/users/mochajs/orgs","repos_url":"https://api.github.com/users/mochajs/repos","events_url":"https://api.github.com/users/mochajs/events{/privacy}","received_events_url":"https://api.github.com/users/mochajs/received_events","type":"Organization","site_admin":false},"repo":{"id":1451352,"name":"mocha","full_name":"mochajs/mocha","owner":{"login":"mochajs","id":8770005,"avatar_url":"https://avatars.githubusercontent.com/u/8770005?v=3","gravatar_id":"","url":"https://api.github.com/users/mochajs","html_url":"https://github.com/mochajs","followers_url":"https://api.github.com/users/mochajs/followers","following_url":"https://api.github.com/users/mochajs/following{/other_user}","gists_url":"https://api.github.com/users/mochajs/gists{/gist_id}","starred_url":"https://api.github.com/users/mochajs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mochajs/subscriptions","organizations_url":"https://api.github.com/users/mochajs/orgs","repos_url":"https://api.github.com/users/mochajs/repos","events_url":"https://api.github.com/users/mochajs/events{/privacy}","received_events_url":"https://api.github.com/users/mochajs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mochajs/mocha","description":"mocha - simple, flexible, fun javascript test framework for node.js & the browser. (BDD, TDD, QUnit styles via interfaces)","fork":false,"url":"https://api.github.com/repos/mochajs/mocha","forks_url":"https://api.github.com/repos/mochajs/mocha/forks","keys_url":"https://api.github.com/repos/mochajs/mocha/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mochajs/mocha/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mochajs/mocha/teams","hooks_url":"https://api.github.com/repos/mochajs/mocha/hooks","issue_events_url":"https://api.github.com/repos/mochajs/mocha/issues/events{/number}","events_url":"https://api.github.com/repos/mochajs/mocha/events","assignees_url":"https://api.github.com/repos/mochajs/mocha/assignees{/user}","branches_url":"https://api.github.com/repos/mochajs/mocha/branches{/branch}","tags_url":"https://api.github.com/repos/mochajs/mocha/tags","blobs_url":"https://api.github.com/repos/mochajs/mocha/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mochajs/mocha/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mochajs/mocha/git/refs{/sha}","trees_url":"https://api.github.com/repos/mochajs/mocha/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mochajs/mocha/statuses/{sha}","languages_url":"https://api.github.com/repos/mochajs/mocha/languages","stargazers_url":"https://api.github.com/repos/mochajs/mocha/stargazers","contributors_url":"https://api.github.com/repos/mochajs/mocha/contributors","subscribers_url":"https://api.github.com/repos/mochajs/mocha/subscribers","subscription_url":"https://api.github.com/repos/mochajs/mocha/subscription","commits_url":"https://api.github.com/repos/mochajs/mocha/commits{/sha}","git_commits_url":"https://api.github.com/repos/mochajs/mocha/git/commits{/sha}","comments_url":"https://api.github.com/repos/mochajs/mocha/comments{/number}","issue_comment_url":"https://api.github.com/repos/mochajs/mocha/issues/comments/{number}","contents_url":"https://api.github.com/repos/mochajs/mocha/contents/{+path}","compare_url":"https://api.github.com/repos/mochajs/mocha/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mochajs/mocha/merges","archive_url":"https://api.github.com/repos/mochajs/mocha/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mochajs/mocha/downloads","issues_url":"https://api.github.com/repos/mochajs/mocha/issues{/number}","pulls_url":"https://api.github.com/repos/mochajs/mocha/pulls{/number}","milestones_url":"https://api.github.com/repos/mochajs/mocha/milestones{/number}","notifications_url":"https://api.github.com/repos/mochajs/mocha/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mochajs/mocha/labels{/name}","releases_url":"https://api.github.com/repos/mochajs/mocha/releases{/id}","created_at":"2011-03-07T18:44:25Z","updated_at":"2014-11-18T05:45:35Z","pushed_at":"2014-11-18T05:45:33Z","git_url":"git://github.com/mochajs/mocha.git","ssh_url":"git@github.com:mochajs/mocha.git","clone_url":"https://github.com/mochajs/mocha.git","svn_url":"https://github.com/mochajs/mocha","homepage":"http://mochajs.org","size":14771,"stargazers_count":5506,"watchers_count":5506,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":914,"mirror_url":null,"open_issues_count":179,"forks":914,"open_issues":179,"watchers":5506,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mochajs/mocha/pulls/1427"},"html":{"href":"https://github.com/mochajs/mocha/pull/1427"},"issue":{"href":"https://api.github.com/repos/mochajs/mocha/issues/1427"},"comments":{"href":"https://api.github.com/repos/mochajs/mocha/issues/1427/comments"},"review_comments":{"href":"https://api.github.com/repos/mochajs/mocha/pulls/1427/comments"},"review_comment":{"href":"https://api.github.com/repos/mochajs/mocha/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/mochajs/mocha/pulls/1427/commits"},"statuses":{"href":"https://api.github.com/repos/mochajs/mocha/statuses/c7cf3ea729f73d3fc07f672dbe44ede5d41512d5"}}}}