{"action":"created","comment":{"url":"https://api.github.com/repos/gemini-testing/hermione/pulls/comments/88179528","pull_request_review_id":8759907,"id":88179528,"diff_hunk":"@@ -104,100 +79,106 @@ describe('config options', () => {\n                 ignoreLeaks: true\n             };\n \n-            const readConfig = mkConfig_({mochaOpts});\n-            ConfigReader.prototype.read.returns(readConfig);\n-\n-            const parsedConfig = Config.create({}).parse();\n-\n+            const parsedConfig = parseConfig_({mochaOpts});\n             assert.deepEqual(parsedConfig.mochaOpts, mochaOpts);\n         });\n     });\n \n     ['prepareBrowser', 'prepareEnvironment'].forEach((option) => {\n         describe(`${option}`, () => {\n             it(`should throw error if ${option} is not a null or function`, () => {\n-                const readConfig = mkConfig_(_.set({}, option, {}));\n-                ConfigReader.prototype.read.returns(readConfig);\n-\n-                const config = Config.create({});\n-\n-                assert.throws(() => config.parse(), Error, `\"${option}\" should be null or function`);\n+                assert.throws(() => parseConfig_(_.set({}, option, {})), Error, `\"${option}\" should be null or function`);\n             });\n \n             it(`should set default ${option} option if it does not set in config file`, () => {\n-                ConfigReader.prototype.read.returns(mkConfig_());\n-\n-                const parsedConfig = Config.create({}).parse();\n-\n+                const parsedConfig = parseConfig_();\n                 assert.equal(parsedConfig[option], defaults[option]);\n             });\n \n             it(`should override ${option} option`, () => {\n-                const func = () => {};\n-                const readConfig = mkConfig_(_.set({}, option, func));\n-\n-                ConfigReader.prototype.read.returns(readConfig);\n-\n-                const parsedConfig = Config.create({}).parse();\n-\n-                assert.deepEqual(parsedConfig[option], func);\n+                const stub = sandbox.stub();\n+                const parsedConfig = parseConfig_(_.set({}, option, stub));\n+                assert.deepEqual(parsedConfig[option], stub);\n             });\n         });\n     });\n \n     describe('reporters', () => {\n         it('should throw error if reporters is not an array', () => {\n-            const readConfig = mkConfig_({reporters: 'String'});\n-            ConfigReader.prototype.read.returns(readConfig);\n-\n-            const config = Config.create({});\n-\n-            assert.throws(() => config.parse(), Error, '\"reporters\" should be an array');\n+            assert.throws(() => parseConfig_({reporters: 'String'}), Error, '\"reporters\" should be an array');\n         });\n \n         it('should set default reporters option if it does not set in config file', () => {\n-            ConfigReader.prototype.read.returns(mkConfig_());\n-\n-            const parsedConfig = Config.create({}).parse();\n-\n+            const parsedConfig = parseConfig_();\n             assert.sameMembers(parsedConfig.reporters, defaults.reporters);\n         });\n \n         it('should override reporters option', () => {\n-            const readConfig = mkConfig_({reporters: ['foo', 'bar']});\n-            ConfigReader.prototype.read.returns(readConfig);\n-\n-            const parsedConfig = Config.create({}).parse();\n-\n+            const parsedConfig = parseConfig_({reporters: ['foo', 'bar']});\n             assert.deepEqual(parsedConfig.reporters, ['foo', 'bar']);\n         });\n     });\n \n     describe('specs', () => {\n         it('should throw error if specs is empty', () => {\n-            ConfigReader.prototype.read.returns({});\n-\n-            const config = Config.create({});\n-\n-            assert.throws(() => config.parse(), Error, '\"specs\" is required option and should not be empty');\n+            assert.throws(() => parseConfig_({specs: []}), Error, '\"specs\" is required option and should not be empty');\n         });\n \n         it('should throw error if specs option is not an array', () => {\n-            const readConfig = mkConfig_({specs: 'String'});\n-            ConfigReader.prototype.read.returns(readConfig);\n-\n-            const config = Config.create({});\n-\n-            assert.throws(() => config.parse(), Error, '\"specs\" should be an array');\n+            assert.throws(() => parseConfig_({specs: 'String'}), Error, '\"specs\" should be an array');\n         });\n \n         it('should override specs option', () => {\n-            const readConfig = mkConfig_({specs: ['bar', 'baz']});\n-            ConfigReader.prototype.read.returns(readConfig);\n-\n-            const parsedConfig = Config.create({}).parse();\n-\n+            const parsedConfig = parseConfig_({specs: ['bar', 'baz']});\n             assert.deepEqual(parsedConfig.specs, ['bar', 'baz']);\n         });\n     });\n+\n+    describe('plugins', () => {\n+        const assertParsesEnv = (config, options) => {\n+            const name = _.snakeCase(options.property);\n+            const result = parseConfig_(config, _.set({}, `hermione_${name}`, options.value));\n+            assert.deepEqual(_.get(result, options.property), options.expected);\n+        };\n+\n+        const assertParsesCli = (config, options) => {\n+            const name = _.kebabCase(options.property);\n+            const result = parseConfig_(config, {}, [`--${name}`, options.value]);\n+            assert.deepEqual(_.get(result, options.property), options.expected);\n+        };\n+\n+        const testObjectOption = (name) => {\n+            it('should parse any of primitive type from environment', () => {\n+                ['string', 1.0, 1, false, null, [], {a: 1}].forEach((expected) => {\n+                    const value = JSON.stringify(expected);\n+                    assertParsesEnv(_.set({}, name, {}), {property: name, value, expected});","path":"test/lib/config/options.js","position":175,"original_position":243,"commit_id":"4a666a1340d5f8c8a49c80da3798f4586e48b127","original_commit_id":"beca1b50d97df604e9cc21638f53d89c212553a6","user":{"login":"j0tunn","id":7701229,"avatar_url":"https://avatars.githubusercontent.com/u/7701229?v=3","gravatar_id":"","url":"https://api.github.com/users/j0tunn","html_url":"https://github.com/j0tunn","followers_url":"https://api.github.com/users/j0tunn/followers","following_url":"https://api.github.com/users/j0tunn/following{/other_user}","gists_url":"https://api.github.com/users/j0tunn/gists{/gist_id}","starred_url":"https://api.github.com/users/j0tunn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/j0tunn/subscriptions","organizations_url":"https://api.github.com/users/j0tunn/orgs","repos_url":"https://api.github.com/users/j0tunn/repos","events_url":"https://api.github.com/users/j0tunn/events{/privacy}","received_events_url":"https://api.github.com/users/j0tunn/received_events","type":"User","site_admin":false},"body":"а, блин, там как раз путь используется: `plugins.plugin`, с вложенностью. Но вообще непонятно зачем тогда действительно выносить в функцию, если она вызывается один раз","created_at":"2016-11-16T07:15:22Z","updated_at":"2016-11-16T07:15:22Z","html_url":"https://github.com/gemini-testing/hermione/pull/83#discussion_r88179528","pull_request_url":"https://api.github.com/repos/gemini-testing/hermione/pulls/83","_links":{"self":{"href":"https://api.github.com/repos/gemini-testing/hermione/pulls/comments/88179528"},"html":{"href":"https://github.com/gemini-testing/hermione/pull/83#discussion_r88179528"},"pull_request":{"href":"https://api.github.com/repos/gemini-testing/hermione/pulls/83"}}},"pull_request":{"url":"https://api.github.com/repos/gemini-testing/hermione/pulls/83","id":92971382,"html_url":"https://github.com/gemini-testing/hermione/pull/83","diff_url":"https://github.com/gemini-testing/hermione/pull/83.diff","patch_url":"https://github.com/gemini-testing/hermione/pull/83.patch","issue_url":"https://api.github.com/repos/gemini-testing/hermione/issues/83","number":83,"state":"open","locked":false,"title":"Programmatic api","user":{"login":"seth2810","id":845078,"avatar_url":"https://avatars.githubusercontent.com/u/845078?v=3","gravatar_id":"","url":"https://api.github.com/users/seth2810","html_url":"https://github.com/seth2810","followers_url":"https://api.github.com/users/seth2810/followers","following_url":"https://api.github.com/users/seth2810/following{/other_user}","gists_url":"https://api.github.com/users/seth2810/gists{/gist_id}","starred_url":"https://api.github.com/users/seth2810/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/seth2810/subscriptions","organizations_url":"https://api.github.com/users/seth2810/orgs","repos_url":"https://api.github.com/users/seth2810/repos","events_url":"https://api.github.com/users/seth2810/events{/privacy}","received_events_url":"https://api.github.com/users/seth2810/received_events","type":"User","site_admin":false},"body":"Currently reading of hermione configuration file ocurred outside of constructor in command line interface like as well as validation of empty browser objects. This leads to additional efforts if you want to create and run hermione through api. Also I add similar [ability to pass primitive values for plugins through cli/env](https://github.com/gemini-testing/gemini/pull/661) that recently added in gemini.","created_at":"2016-11-09T14:21:23Z","updated_at":"2016-11-16T07:15:22Z","closed_at":null,"merged_at":null,"merge_commit_sha":"51307599feede323aee64777ec9e0b697b8c2339","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/gemini-testing/hermione/pulls/83/commits","review_comments_url":"https://api.github.com/repos/gemini-testing/hermione/pulls/83/comments","review_comment_url":"https://api.github.com/repos/gemini-testing/hermione/pulls/comments{/number}","comments_url":"https://api.github.com/repos/gemini-testing/hermione/issues/83/comments","statuses_url":"https://api.github.com/repos/gemini-testing/hermione/statuses/4a666a1340d5f8c8a49c80da3798f4586e48b127","head":{"label":"gemini-testing:programmatic-api","ref":"programmatic-api","sha":"4a666a1340d5f8c8a49c80da3798f4586e48b127","user":{"login":"gemini-testing","id":11424134,"avatar_url":"https://avatars.githubusercontent.com/u/11424134?v=3","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":51917537,"name":"hermione","full_name":"gemini-testing/hermione","owner":{"login":"gemini-testing","id":11424134,"avatar_url":"https://avatars.githubusercontent.com/u/11424134?v=3","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","description":"Browser test runner based on mocha and wdio","fork":false,"url":"https://api.github.com/repos/gemini-testing/hermione","forks_url":"https://api.github.com/repos/gemini-testing/hermione/forks","keys_url":"https://api.github.com/repos/gemini-testing/hermione/keys{/key_id}","collaborators_url":"https://api.github.com/repos/gemini-testing/hermione/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/gemini-testing/hermione/teams","hooks_url":"https://api.github.com/repos/gemini-testing/hermione/hooks","issue_events_url":"https://api.github.com/repos/gemini-testing/hermione/issues/events{/number}","events_url":"https://api.github.com/repos/gemini-testing/hermione/events","assignees_url":"https://api.github.com/repos/gemini-testing/hermione/assignees{/user}","branches_url":"https://api.github.com/repos/gemini-testing/hermione/branches{/branch}","tags_url":"https://api.github.com/repos/gemini-testing/hermione/tags","blobs_url":"https://api.github.com/repos/gemini-testing/hermione/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/gemini-testing/hermione/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/gemini-testing/hermione/git/refs{/sha}","trees_url":"https://api.github.com/repos/gemini-testing/hermione/git/trees{/sha}","statuses_url":"https://api.github.com/repos/gemini-testing/hermione/statuses/{sha}","languages_url":"https://api.github.com/repos/gemini-testing/hermione/languages","stargazers_url":"https://api.github.com/repos/gemini-testing/hermione/stargazers","contributors_url":"https://api.github.com/repos/gemini-testing/hermione/contributors","subscribers_url":"https://api.github.com/repos/gemini-testing/hermione/subscribers","subscription_url":"https://api.github.com/repos/gemini-testing/hermione/subscription","commits_url":"https://api.github.com/repos/gemini-testing/hermione/commits{/sha}","git_commits_url":"https://api.github.com/repos/gemini-testing/hermione/git/commits{/sha}","comments_url":"https://api.github.com/repos/gemini-testing/hermione/comments{/number}","issue_comment_url":"https://api.github.com/repos/gemini-testing/hermione/issues/comments{/number}","contents_url":"https://api.github.com/repos/gemini-testing/hermione/contents/{+path}","compare_url":"https://api.github.com/repos/gemini-testing/hermione/compare/{base}...{head}","merges_url":"https://api.github.com/repos/gemini-testing/hermione/merges","archive_url":"https://api.github.com/repos/gemini-testing/hermione/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/gemini-testing/hermione/downloads","issues_url":"https://api.github.com/repos/gemini-testing/hermione/issues{/number}","pulls_url":"https://api.github.com/repos/gemini-testing/hermione/pulls{/number}","milestones_url":"https://api.github.com/repos/gemini-testing/hermione/milestones{/number}","notifications_url":"https://api.github.com/repos/gemini-testing/hermione/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/gemini-testing/hermione/labels{/name}","releases_url":"https://api.github.com/repos/gemini-testing/hermione/releases{/id}","deployments_url":"https://api.github.com/repos/gemini-testing/hermione/deployments","created_at":"2016-02-17T11:26:05Z","updated_at":"2016-11-10T17:58:37Z","pushed_at":"2016-11-15T14:41:36Z","git_url":"git://github.com/gemini-testing/hermione.git","ssh_url":"git@github.com:gemini-testing/hermione.git","clone_url":"https://github.com/gemini-testing/hermione.git","svn_url":"https://github.com/gemini-testing/hermione","homepage":null,"size":576,"stargazers_count":35,"watchers_count":35,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5,"mirror_url":null,"open_issues_count":8,"forks":5,"open_issues":8,"watchers":35,"default_branch":"master"}},"base":{"label":"gemini-testing:master","ref":"master","sha":"171ee2e367d94f5c008f402df9c03342194b701f","user":{"login":"gemini-testing","id":11424134,"avatar_url":"https://avatars.githubusercontent.com/u/11424134?v=3","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":51917537,"name":"hermione","full_name":"gemini-testing/hermione","owner":{"login":"gemini-testing","id":11424134,"avatar_url":"https://avatars.githubusercontent.com/u/11424134?v=3","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","description":"Browser test runner based on mocha and wdio","fork":false,"url":"https://api.github.com/repos/gemini-testing/hermione","forks_url":"https://api.github.com/repos/gemini-testing/hermione/forks","keys_url":"https://api.github.com/repos/gemini-testing/hermione/keys{/key_id}","collaborators_url":"https://api.github.com/repos/gemini-testing/hermione/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/gemini-testing/hermione/teams","hooks_url":"https://api.github.com/repos/gemini-testing/hermione/hooks","issue_events_url":"https://api.github.com/repos/gemini-testing/hermione/issues/events{/number}","events_url":"https://api.github.com/repos/gemini-testing/hermione/events","assignees_url":"https://api.github.com/repos/gemini-testing/hermione/assignees{/user}","branches_url":"https://api.github.com/repos/gemini-testing/hermione/branches{/branch}","tags_url":"https://api.github.com/repos/gemini-testing/hermione/tags","blobs_url":"https://api.github.com/repos/gemini-testing/hermione/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/gemini-testing/hermione/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/gemini-testing/hermione/git/refs{/sha}","trees_url":"https://api.github.com/repos/gemini-testing/hermione/git/trees{/sha}","statuses_url":"https://api.github.com/repos/gemini-testing/hermione/statuses/{sha}","languages_url":"https://api.github.com/repos/gemini-testing/hermione/languages","stargazers_url":"https://api.github.com/repos/gemini-testing/hermione/stargazers","contributors_url":"https://api.github.com/repos/gemini-testing/hermione/contributors","subscribers_url":"https://api.github.com/repos/gemini-testing/hermione/subscribers","subscription_url":"https://api.github.com/repos/gemini-testing/hermione/subscription","commits_url":"https://api.github.com/repos/gemini-testing/hermione/commits{/sha}","git_commits_url":"https://api.github.com/repos/gemini-testing/hermione/git/commits{/sha}","comments_url":"https://api.github.com/repos/gemini-testing/hermione/comments{/number}","issue_comment_url":"https://api.github.com/repos/gemini-testing/hermione/issues/comments{/number}","contents_url":"https://api.github.com/repos/gemini-testing/hermione/contents/{+path}","compare_url":"https://api.github.com/repos/gemini-testing/hermione/compare/{base}...{head}","merges_url":"https://api.github.com/repos/gemini-testing/hermione/merges","archive_url":"https://api.github.com/repos/gemini-testing/hermione/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/gemini-testing/hermione/downloads","issues_url":"https://api.github.com/repos/gemini-testing/hermione/issues{/number}","pulls_url":"https://api.github.com/repos/gemini-testing/hermione/pulls{/number}","milestones_url":"https://api.github.com/repos/gemini-testing/hermione/milestones{/number}","notifications_url":"https://api.github.com/repos/gemini-testing/hermione/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/gemini-testing/hermione/labels{/name}","releases_url":"https://api.github.com/repos/gemini-testing/hermione/releases{/id}","deployments_url":"https://api.github.com/repos/gemini-testing/hermione/deployments","created_at":"2016-02-17T11:26:05Z","updated_at":"2016-11-10T17:58:37Z","pushed_at":"2016-11-15T14:41:36Z","git_url":"git://github.com/gemini-testing/hermione.git","ssh_url":"git@github.com:gemini-testing/hermione.git","clone_url":"https://github.com/gemini-testing/hermione.git","svn_url":"https://github.com/gemini-testing/hermione","homepage":null,"size":576,"stargazers_count":35,"watchers_count":35,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5,"mirror_url":null,"open_issues_count":8,"forks":5,"open_issues":8,"watchers":35,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/gemini-testing/hermione/pulls/83"},"html":{"href":"https://github.com/gemini-testing/hermione/pull/83"},"issue":{"href":"https://api.github.com/repos/gemini-testing/hermione/issues/83"},"comments":{"href":"https://api.github.com/repos/gemini-testing/hermione/issues/83/comments"},"review_comments":{"href":"https://api.github.com/repos/gemini-testing/hermione/pulls/83/comments"},"review_comment":{"href":"https://api.github.com/repos/gemini-testing/hermione/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/gemini-testing/hermione/pulls/83/commits"},"statuses":{"href":"https://api.github.com/repos/gemini-testing/hermione/statuses/4a666a1340d5f8c8a49c80da3798f4586e48b127"}}}}
{"actor":{"display_login":"j0tunn"}}