{"action":"created","comment":{"url":"https://api.github.com/repos/gemini-testing/hermione-passive-browsers/pulls/comments/200204616","pull_request_review_id":134473741,"id":200204616,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwMDIwNDYxNg==","diff_hunk":"@@ -0,0 +1,66 @@\n+'use strict';\n+\n+const _ = require('lodash');\n+const parseConfig = require('./config');\n+\n+const isMatched = (matcher, value) => _.isRegExp(matcher) ? matcher.test(value) : _.isEqual(matcher, value);\n+const shouldRunInBro = (browserId, matcher) => [].concat(matcher).some((m) => isMatched(m, browserId));\n+const getPassiveBrowserIds = (hermione, {browsers: passiveBrowserMatchers}) => {\n+    const browserIds = hermione.config.getBrowserIds();\n+\n+    return _([].concat(passiveBrowserMatchers))\n+        .flatMap((browserMatcher) => browserIds.filter((browserId) => isMatched(browserMatcher, browserId)))\n+        .uniq()\n+        .value();\n+};\n+\n+module.exports = (hermione, opts) => {\n+    const config = parseConfig(opts);\n+\n+    if (!config.enabled) {\n+        return;\n+    }\n+\n+    const runnablesToRun = {};\n+    const commandHandlers = {};\n+    const commandHandlersFor = (browserId) => ({\n+        in: hermione.isWorker() ? () => {} : function (matcher) {\n+            if (!runnablesToRun[browserId]) {\n+                runnablesToRun[browserId] = [];\n+            }\n+\n+            runnablesToRun[browserId].push({id: this.id(), matcher});\n+        }\n+    });\n+\n+    hermione.on(hermione.events.BEFORE_FILE_READ, ({browser: browserId, testParser}) => {\n+        if (!commandHandlers[browserId]) {\n+            commandHandlers[browserId] = commandHandlersFor(browserId);\n+        }\n+\n+        testParser.setController(config.commandName, commandHandlers[browserId]);\n+    });\n+\n+    if (!hermione.isWorker()) {\n+        const shouldRunTest = (test, browserId) => {\n+            const foundRunnable = test.id && _.find(runnablesToRun[browserId], {id: test.id()});\n+\n+            return test.id && foundRunnable && shouldRunInBro(browserId, foundRunnable.matcher)","path":"lib/index.js","position":48,"original_position":48,"commit_id":"a2c0d4ace5df241bf42cfb9706c7dd8bc7598cc6","original_commit_id":"a2c0d4ace5df241bf42cfb9706c7dd8bc7598cc6","user":{"login":"tormozz48","id":996162,"node_id":"MDQ6VXNlcjk5NjE2Mg==","avatar_url":"https://avatars0.githubusercontent.com/u/996162?v=4","gravatar_id":"","url":"https://api.github.com/users/tormozz48","html_url":"https://github.com/tormozz48","followers_url":"https://api.github.com/users/tormozz48/followers","following_url":"https://api.github.com/users/tormozz48/following{/other_user}","gists_url":"https://api.github.com/users/tormozz48/gists{/gist_id}","starred_url":"https://api.github.com/users/tormozz48/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tormozz48/subscriptions","organizations_url":"https://api.github.com/users/tormozz48/orgs","repos_url":"https://api.github.com/users/tormozz48/repos","events_url":"https://api.github.com/users/tormozz48/events{/privacy}","received_events_url":"https://api.github.com/users/tormozz48/received_events","type":"User","site_admin":false},"body":"Сложное условие. Можно было бы разбить на 2 или хотя бы сгруппировать с помощью скобок.\r\n```js\r\nreturn (foundRunnable && shouldRunInBro(browserId, foundRunnable.matcher)) || (test.parent && shouldRunTest(test.parent, browserId));\r\n```","created_at":"2018-07-04T21:53:51Z","updated_at":"2018-07-04T21:58:15Z","html_url":"https://github.com/gemini-testing/hermione-passive-browsers/pull/2#discussion_r200204616","pull_request_url":"https://api.github.com/repos/gemini-testing/hermione-passive-browsers/pulls/2","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/gemini-testing/hermione-passive-browsers/pulls/comments/200204616"},"html":{"href":"https://github.com/gemini-testing/hermione-passive-browsers/pull/2#discussion_r200204616"},"pull_request":{"href":"https://api.github.com/repos/gemini-testing/hermione-passive-browsers/pulls/2"}},"in_reply_to_id":200157879},"pull_request":{"url":"https://api.github.com/repos/gemini-testing/hermione-passive-browsers/pulls/2","id":199183835,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk5MTgzODM1","html_url":"https://github.com/gemini-testing/hermione-passive-browsers/pull/2","diff_url":"https://github.com/gemini-testing/hermione-passive-browsers/pull/2.diff","patch_url":"https://github.com/gemini-testing/hermione-passive-browsers/pull/2.patch","issue_url":"https://api.github.com/repos/gemini-testing/hermione-passive-browsers/issues/2","number":2,"state":"open","locked":false,"title":"feat: first implementation","user":{"login":"DudaGod","id":5900697,"node_id":"MDQ6VXNlcjU5MDA2OTc=","avatar_url":"https://avatars1.githubusercontent.com/u/5900697?v=4","gravatar_id":"","url":"https://api.github.com/users/DudaGod","html_url":"https://github.com/DudaGod","followers_url":"https://api.github.com/users/DudaGod/followers","following_url":"https://api.github.com/users/DudaGod/following{/other_user}","gists_url":"https://api.github.com/users/DudaGod/gists{/gist_id}","starred_url":"https://api.github.com/users/DudaGod/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DudaGod/subscriptions","organizations_url":"https://api.github.com/users/DudaGod/orgs","repos_url":"https://api.github.com/users/DudaGod/repos","events_url":"https://api.github.com/users/DudaGod/events{/privacy}","received_events_url":"https://api.github.com/users/DudaGod/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-07-04T09:05:13Z","updated_at":"2018-07-04T21:58:15Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f5704459f824cdf4d260065b1042b4d771054411","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/gemini-testing/hermione-passive-browsers/pulls/2/commits","review_comments_url":"https://api.github.com/repos/gemini-testing/hermione-passive-browsers/pulls/2/comments","review_comment_url":"https://api.github.com/repos/gemini-testing/hermione-passive-browsers/pulls/comments{/number}","comments_url":"https://api.github.com/repos/gemini-testing/hermione-passive-browsers/issues/2/comments","statuses_url":"https://api.github.com/repos/gemini-testing/hermione-passive-browsers/statuses/a2c0d4ace5df241bf42cfb9706c7dd8bc7598cc6","head":{"label":"gemini-testing:dd.first_implementation","ref":"dd.first_implementation","sha":"a2c0d4ace5df241bf42cfb9706c7dd8bc7598cc6","user":{"login":"gemini-testing","id":11424134,"node_id":"MDEyOk9yZ2FuaXphdGlvbjExNDI0MTM0","avatar_url":"https://avatars3.githubusercontent.com/u/11424134?v=4","gravatar_id":"","url":"https://api.github.com/users/gemini-testing","html_url":"https://github.com/gemini-testing","followers_url":"https://api.github.com/users/gemini-testing/followers","following_url":"https://api.github.com/users/gemini-testing/following{/other_user}","gists_url":"https://api.github.com/users/gemini-testing/gists{/gist_id}","starred_url":"https://api.github.com/users/gemini-testing/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gemini-testing/subscriptions","organizations_url":"https://api.github.com/users/gemini-testing/orgs","repos_url":"https://api.github.com/users/gemini-testing/repos","events_url":"https://api.github.com/users/gemini-testing/events{/privacy}","received_events_url":"https://api.github.com/users/gemini-testing/received_events","type":"Organization","site_admin":false},"repo":{"id":139429813,"node_id":"MDEwOlJlcG9zaXRvcnkxMzk0Mjk4MTM=","name":"hermione-passive-browsers","full_name":"gemini-testing/hermione-passive-browsers","owner":{"login":"gemini-testing","id":11424134,"node_id":"MDEyOk9yZ2FuaXphdGlvbjExNDI0MTM0","avatar_url":"https://avatars3.githubusercontent.com/u/11424134?v=4","gravatar_id":"","url":"https://api.github.com/users/gemini-testing","html_url":"https://github.com/gemini-testing","followers_url":"https://api.github.com/users/gemini-testing/followers","following_url":"https://api.github.com/users/gemini-testing/following{/other_user}","gists_url":"https://api.github.com/users/gemini-testing/gists{/gist_id}","starred_url":"https://api.github.com/users/gemini-testing/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gemini-testing/subscriptions","organizations_url":"https://api.github.com/users/gemini-testing/orgs","repos_url":"https://api.github.com/users/gemini-testing/repos","events_url":"https://api.github.com/users/gemini-testing/events{/privacy}","received_events_url":"https://api.github.com/users/gemini-testing/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/gemini-testing/hermione-passive-browsers","description":"Plugin for hermione to run tests in passive browsers on request","fork":false,"url":"https://api.github.com/repos/gemini-testing/hermione-passive-browsers","forks_url":"https://api.github.com/repos/gemini-testing/hermione-passive-browsers/forks","keys_url":"https://api.github.com/repos/gemini-testing/hermione-passive-browsers/keys{/key_id}","collaborators_url":"https://api.github.com/repos/gemini-testing/hermione-passive-browsers/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/gemini-testing/hermione-passive-browsers/teams","hooks_url":"https://api.github.com/repos/gemini-testing/hermione-passive-browsers/hooks","issue_events_url":"https://api.github.com/repos/gemini-testing/hermione-passive-browsers/issues/events{/number}","events_url":"https://api.github.com/repos/gemini-testing/hermione-passive-browsers/events","assignees_url":"https://api.github.com/repos/gemini-testing/hermione-passive-browsers/assignees{/user}","branches_url":"https://api.github.com/repos/gemini-testing/hermione-passive-browsers/branches{/branch}","tags_url":"https://api.github.com/repos/gemini-testing/hermione-passive-browsers/tags","blobs_url":"https://api.github.com/repos/gemini-testing/hermione-passive-browsers/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/gemini-testing/hermione-passive-browsers/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/gemini-testing/hermione-passive-browsers/git/refs{/sha}","trees_url":"https://api.github.com/repos/gemini-testing/hermione-passive-browsers/git/trees{/sha}","statuses_url":"https://api.github.com/repos/gemini-testing/hermione-passive-browsers/statuses/{sha}","languages_url":"https://api.github.com/repos/gemini-testing/hermione-passive-browsers/languages","stargazers_url":"https://api.github.com/repos/gemini-testing/hermione-passive-browsers/stargazers","contributors_url":"https://api.github.com/repos/gemini-testing/hermione-passive-browsers/contributors","subscribers_url":"https://api.github.com/repos/gemini-testing/hermione-passive-browsers/subscribers","subscription_url":"https://api.github.com/repos/gemini-testing/hermione-passive-browsers/subscription","commits_url":"https://api.github.com/repos/gemini-testing/hermione-passive-browsers/commits{/sha}","git_commits_url":"https://api.github.com/repos/gemini-testing/hermione-passive-browsers/git/commits{/sha}","comments_url":"https://api.github.com/repos/gemini-testing/hermione-passive-browsers/comments{/number}","issue_comment_url":"https://api.github.com/repos/gemini-testing/hermione-passive-browsers/issues/comments{/number}","contents_url":"https://api.github.com/repos/gemini-testing/hermione-passive-browsers/contents/{+path}","compare_url":"https://api.github.com/repos/gemini-testing/hermione-passive-browsers/compare/{base}...{head}","merges_url":"https://api.github.com/repos/gemini-testing/hermione-passive-browsers/merges","archive_url":"https://api.github.com/repos/gemini-testing/hermione-passive-browsers/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/gemini-testing/hermione-passive-browsers/downloads","issues_url":"https://api.github.com/repos/gemini-testing/hermione-passive-browsers/issues{/number}","pulls_url":"https://api.github.com/repos/gemini-testing/hermione-passive-browsers/pulls{/number}","milestones_url":"https://api.github.com/repos/gemini-testing/hermione-passive-browsers/milestones{/number}","notifications_url":"https://api.github.com/repos/gemini-testing/hermione-passive-browsers/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/gemini-testing/hermione-passive-browsers/labels{/name}","releases_url":"https://api.github.com/repos/gemini-testing/hermione-passive-browsers/releases{/id}","deployments_url":"https://api.github.com/repos/gemini-testing/hermione-passive-browsers/deployments","created_at":"2018-07-02T10:44:52Z","updated_at":"2018-07-02T11:13:12Z","pushed_at":"2018-07-04T12:11:50Z","git_url":"git://github.com/gemini-testing/hermione-passive-browsers.git","ssh_url":"git@github.com:gemini-testing/hermione-passive-browsers.git","clone_url":"https://github.com/gemini-testing/hermione-passive-browsers.git","svn_url":"https://github.com/gemini-testing/hermione-passive-browsers","homepage":null,"size":22,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"gemini-testing:master","ref":"master","sha":"9871c99de62c057babd9b9e4c977d7a13b86f780","user":{"login":"gemini-testing","id":11424134,"node_id":"MDEyOk9yZ2FuaXphdGlvbjExNDI0MTM0","avatar_url":"https://avatars3.githubusercontent.com/u/11424134?v=4","gravatar_id":"","url":"https://api.github.com/users/gemini-testing","html_url":"https://github.com/gemini-testing","followers_url":"https://api.github.com/users/gemini-testing/followers","following_url":"https://api.github.com/users/gemini-testing/following{/other_user}","gists_url":"https://api.github.com/users/gemini-testing/gists{/gist_id}","starred_url":"https://api.github.com/users/gemini-testing/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gemini-testing/subscriptions","organizations_url":"https://api.github.com/users/gemini-testing/orgs","repos_url":"https://api.github.com/users/gemini-testing/repos","events_url":"https://api.github.com/users/gemini-testing/events{/privacy}","received_events_url":"https://api.github.com/users/gemini-testing/received_events","type":"Organization","site_admin":false},"repo":{"id":139429813,"node_id":"MDEwOlJlcG9zaXRvcnkxMzk0Mjk4MTM=","name":"hermione-passive-browsers","full_name":"gemini-testing/hermione-passive-browsers","owner":{"login":"gemini-testing","id":11424134,"node_id":"MDEyOk9yZ2FuaXphdGlvbjExNDI0MTM0","avatar_url":"https://avatars3.githubusercontent.com/u/11424134?v=4","gravatar_id":"","url":"https://api.github.com/users/gemini-testing","html_url":"https://github.com/gemini-testing","followers_url":"https://api.github.com/users/gemini-testing/followers","following_url":"https://api.github.com/users/gemini-testing/following{/other_user}","gists_url":"https://api.github.com/users/gemini-testing/gists{/gist_id}","starred_url":"https://api.github.com/users/gemini-testing/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gemini-testing/subscriptions","organizations_url":"https://api.github.com/users/gemini-testing/orgs","repos_url":"https://api.github.com/users/gemini-testing/repos","events_url":"https://api.github.com/users/gemini-testing/events{/privacy}","received_events_url":"https://api.github.com/users/gemini-testing/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/gemini-testing/hermione-passive-browsers","description":"Plugin for hermione to run tests in passive browsers on request","fork":false,"url":"https://api.github.com/repos/gemini-testing/hermione-passive-browsers","forks_url":"https://api.github.com/repos/gemini-testing/hermione-passive-browsers/forks","keys_url":"https://api.github.com/repos/gemini-testing/hermione-passive-browsers/keys{/key_id}","collaborators_url":"https://api.github.com/repos/gemini-testing/hermione-passive-browsers/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/gemini-testing/hermione-passive-browsers/teams","hooks_url":"https://api.github.com/repos/gemini-testing/hermione-passive-browsers/hooks","issue_events_url":"https://api.github.com/repos/gemini-testing/hermione-passive-browsers/issues/events{/number}","events_url":"https://api.github.com/repos/gemini-testing/hermione-passive-browsers/events","assignees_url":"https://api.github.com/repos/gemini-testing/hermione-passive-browsers/assignees{/user}","branches_url":"https://api.github.com/repos/gemini-testing/hermione-passive-browsers/branches{/branch}","tags_url":"https://api.github.com/repos/gemini-testing/hermione-passive-browsers/tags","blobs_url":"https://api.github.com/repos/gemini-testing/hermione-passive-browsers/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/gemini-testing/hermione-passive-browsers/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/gemini-testing/hermione-passive-browsers/git/refs{/sha}","trees_url":"https://api.github.com/repos/gemini-testing/hermione-passive-browsers/git/trees{/sha}","statuses_url":"https://api.github.com/repos/gemini-testing/hermione-passive-browsers/statuses/{sha}","languages_url":"https://api.github.com/repos/gemini-testing/hermione-passive-browsers/languages","stargazers_url":"https://api.github.com/repos/gemini-testing/hermione-passive-browsers/stargazers","contributors_url":"https://api.github.com/repos/gemini-testing/hermione-passive-browsers/contributors","subscribers_url":"https://api.github.com/repos/gemini-testing/hermione-passive-browsers/subscribers","subscription_url":"https://api.github.com/repos/gemini-testing/hermione-passive-browsers/subscription","commits_url":"https://api.github.com/repos/gemini-testing/hermione-passive-browsers/commits{/sha}","git_commits_url":"https://api.github.com/repos/gemini-testing/hermione-passive-browsers/git/commits{/sha}","comments_url":"https://api.github.com/repos/gemini-testing/hermione-passive-browsers/comments{/number}","issue_comment_url":"https://api.github.com/repos/gemini-testing/hermione-passive-browsers/issues/comments{/number}","contents_url":"https://api.github.com/repos/gemini-testing/hermione-passive-browsers/contents/{+path}","compare_url":"https://api.github.com/repos/gemini-testing/hermione-passive-browsers/compare/{base}...{head}","merges_url":"https://api.github.com/repos/gemini-testing/hermione-passive-browsers/merges","archive_url":"https://api.github.com/repos/gemini-testing/hermione-passive-browsers/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/gemini-testing/hermione-passive-browsers/downloads","issues_url":"https://api.github.com/repos/gemini-testing/hermione-passive-browsers/issues{/number}","pulls_url":"https://api.github.com/repos/gemini-testing/hermione-passive-browsers/pulls{/number}","milestones_url":"https://api.github.com/repos/gemini-testing/hermione-passive-browsers/milestones{/number}","notifications_url":"https://api.github.com/repos/gemini-testing/hermione-passive-browsers/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/gemini-testing/hermione-passive-browsers/labels{/name}","releases_url":"https://api.github.com/repos/gemini-testing/hermione-passive-browsers/releases{/id}","deployments_url":"https://api.github.com/repos/gemini-testing/hermione-passive-browsers/deployments","created_at":"2018-07-02T10:44:52Z","updated_at":"2018-07-02T11:13:12Z","pushed_at":"2018-07-04T12:11:50Z","git_url":"git://github.com/gemini-testing/hermione-passive-browsers.git","ssh_url":"git@github.com:gemini-testing/hermione-passive-browsers.git","clone_url":"https://github.com/gemini-testing/hermione-passive-browsers.git","svn_url":"https://github.com/gemini-testing/hermione-passive-browsers","homepage":null,"size":22,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/gemini-testing/hermione-passive-browsers/pulls/2"},"html":{"href":"https://github.com/gemini-testing/hermione-passive-browsers/pull/2"},"issue":{"href":"https://api.github.com/repos/gemini-testing/hermione-passive-browsers/issues/2"},"comments":{"href":"https://api.github.com/repos/gemini-testing/hermione-passive-browsers/issues/2/comments"},"review_comments":{"href":"https://api.github.com/repos/gemini-testing/hermione-passive-browsers/pulls/2/comments"},"review_comment":{"href":"https://api.github.com/repos/gemini-testing/hermione-passive-browsers/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/gemini-testing/hermione-passive-browsers/pulls/2/commits"},"statuses":{"href":"https://api.github.com/repos/gemini-testing/hermione-passive-browsers/statuses/a2c0d4ace5df241bf42cfb9706c7dd8bc7598cc6"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"tormozz48"}}