{"action":"created","comment":{"url":"https://api.github.com/repos/bem-incubator/bem-config/pulls/comments/47436481","id":47436481,"diff_hunk":"@@ -0,0 +1,73 @@\n+var mock = require('mock-fs'),\n+    expect = require('chai').expect,\n+    findConfigPath = require.resolve('find-config'),\n+    osHomedirPath = require.resolve('os-homedir'),\n+    bemConfigPath = require.resolve('..'),\n+    tilde = require(osHomedirPath)(),\n+    rootConfigPath = tilde + '/.bem/config.json';\n+\n+    require(findConfigPath);\n+    require(bemConfigPath);\n+\n+describe('bem-config tests', function() {\n+\n+    afterEach(function () {\n+        mock.restore();\n+    });\n+\n+    it('should return empty configs', function() {\n+        var scheme = {};\n+        mock(scheme);\n+\n+        var config = require('..');\n+        expect({\n+            global: {},\n+            local: {},\n+            extended: {}\n+        }).eql(config());\n+    });\n+\n+    it('should return root config', function() {\n+        var scheme = {};\n+        scheme[rootConfigPath] = '{ \"ROOT\": \"1\" }';\n+        mock(scheme);\n+        var config = require('..');\n+\n+        expect({\n+            global: { 'ROOT': '1' },\n+            local: { 'ROOT': '1' },\n+            extended: { 'ROOT': '1' }\n+        }).eql(config());\n+    });\n+\n+    it('should return local config', function() {\n+        var scheme = {};\n+        scheme[rootConfigPath] = '{ \"ROOT\": \"1\" }';\n+        scheme['.bem/config.json'] = '{ \"LOCAL\": \"1\" }';\n+\n+        mock(scheme);\n+        var config = require('..');\n+\n+        expect({\n+            global: { \"ROOT\": \"1\" },\n+            local: { 'LOCAL': '1' },\n+            extended: { \"ROOT\": \"1\", 'LOCAL': '1' }\n+        }).eql(config());\n+    });\n+\n+    it('should return extended config', function() {\n+        var scheme = {};\n+        scheme[rootConfigPath] = '{ \"ROOT\": \"1\" }';\n+        scheme['.bem/config.json'] = '{ \"LOCAL\": \"1\" }';\n+\n+        mock(scheme);\n+        var config = require('..');\n+\n+        expect({\n+            global: { \"ROOT\": \"1\" },\n+            local: { 'LOCAL': '1' },\n+            extended: { \"ROOT\": \"1\", 'LOCAL': '1', 'EXTENDED': '1' }\n+        }).eql(config({ 'EXTENDED': '1'}));","path":"test/test.js","position":70,"original_position":70,"commit_id":"98be560d5da3ecf0b21eaad338a51876893e3161","original_commit_id":"98be560d5da3ecf0b21eaad338a51876893e3161","user":{"login":"zxqfox","id":677518,"avatar_url":"https://avatars.githubusercontent.com/u/677518?v=3","gravatar_id":"","url":"https://api.github.com/users/zxqfox","html_url":"https://github.com/zxqfox","followers_url":"https://api.github.com/users/zxqfox/followers","following_url":"https://api.github.com/users/zxqfox/following{/other_user}","gists_url":"https://api.github.com/users/zxqfox/gists{/gist_id}","starred_url":"https://api.github.com/users/zxqfox/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zxqfox/subscriptions","organizations_url":"https://api.github.com/users/zxqfox/orgs","repos_url":"https://api.github.com/users/zxqfox/repos","events_url":"https://api.github.com/users/zxqfox/events{/privacy}","received_events_url":"https://api.github.com/users/zxqfox/received_events","type":"User","site_admin":false},"body":"Наоборот же","created_at":"2015-12-12T20:38:59Z","updated_at":"2015-12-12T20:38:59Z","html_url":"https://github.com/bem-incubator/bem-config/pull/1#discussion_r47436481","pull_request_url":"https://api.github.com/repos/bem-incubator/bem-config/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/bem-incubator/bem-config/pulls/comments/47436481"},"html":{"href":"https://github.com/bem-incubator/bem-config/pull/1#discussion_r47436481"},"pull_request":{"href":"https://api.github.com/repos/bem-incubator/bem-config/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/bem-incubator/bem-config/pulls/1","id":53484655,"html_url":"https://github.com/bem-incubator/bem-config/pull/1","diff_url":"https://github.com/bem-incubator/bem-config/pull/1.diff","patch_url":"https://github.com/bem-incubator/bem-config/pull/1.patch","issue_url":"https://api.github.com/repos/bem-incubator/bem-config/issues/1","number":1,"state":"open","locked":false,"title":"test init","user":{"login":"voischev","id":1510217,"avatar_url":"https://avatars.githubusercontent.com/u/1510217?v=3","gravatar_id":"","url":"https://api.github.com/users/voischev","html_url":"https://github.com/voischev","followers_url":"https://api.github.com/users/voischev/followers","following_url":"https://api.github.com/users/voischev/following{/other_user}","gists_url":"https://api.github.com/users/voischev/gists{/gist_id}","starred_url":"https://api.github.com/users/voischev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/voischev/subscriptions","organizations_url":"https://api.github.com/users/voischev/orgs","repos_url":"https://api.github.com/users/voischev/repos","events_url":"https://api.github.com/users/voischev/events{/privacy}","received_events_url":"https://api.github.com/users/voischev/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-12-12T20:24:51Z","updated_at":"2015-12-12T20:38:59Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0df365022c9cc43a90c8b5e8f63e5c872b43df4a","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/bem-incubator/bem-config/pulls/1/commits","review_comments_url":"https://api.github.com/repos/bem-incubator/bem-config/pulls/1/comments","review_comment_url":"https://api.github.com/repos/bem-incubator/bem-config/pulls/comments{/number}","comments_url":"https://api.github.com/repos/bem-incubator/bem-config/issues/1/comments","statuses_url":"https://api.github.com/repos/bem-incubator/bem-config/statuses/98be560d5da3ecf0b21eaad338a51876893e3161","head":{"label":"bem-incubator:test","ref":"test","sha":"98be560d5da3ecf0b21eaad338a51876893e3161","user":{"login":"bem-incubator","id":10929504,"avatar_url":"https://avatars.githubusercontent.com/u/10929504?v=3","gravatar_id":"","url":"https://api.github.com/users/bem-incubator","html_url":"https://github.com/bem-incubator","followers_url":"https://api.github.com/users/bem-incubator/followers","following_url":"https://api.github.com/users/bem-incubator/following{/other_user}","gists_url":"https://api.github.com/users/bem-incubator/gists{/gist_id}","starred_url":"https://api.github.com/users/bem-incubator/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bem-incubator/subscriptions","organizations_url":"https://api.github.com/users/bem-incubator/orgs","repos_url":"https://api.github.com/users/bem-incubator/repos","events_url":"https://api.github.com/users/bem-incubator/events{/privacy}","received_events_url":"https://api.github.com/users/bem-incubator/received_events","type":"Organization","site_admin":false},"repo":{"id":47882576,"name":"bem-config","full_name":"bem-incubator/bem-config","owner":{"login":"bem-incubator","id":10929504,"avatar_url":"https://avatars.githubusercontent.com/u/10929504?v=3","gravatar_id":"","url":"https://api.github.com/users/bem-incubator","html_url":"https://github.com/bem-incubator","followers_url":"https://api.github.com/users/bem-incubator/followers","following_url":"https://api.github.com/users/bem-incubator/following{/other_user}","gists_url":"https://api.github.com/users/bem-incubator/gists{/gist_id}","starred_url":"https://api.github.com/users/bem-incubator/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bem-incubator/subscriptions","organizations_url":"https://api.github.com/users/bem-incubator/orgs","repos_url":"https://api.github.com/users/bem-incubator/repos","events_url":"https://api.github.com/users/bem-incubator/events{/privacy}","received_events_url":"https://api.github.com/users/bem-incubator/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/bem-incubator/bem-config","description":"Config module for bem-tools","fork":false,"url":"https://api.github.com/repos/bem-incubator/bem-config","forks_url":"https://api.github.com/repos/bem-incubator/bem-config/forks","keys_url":"https://api.github.com/repos/bem-incubator/bem-config/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bem-incubator/bem-config/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bem-incubator/bem-config/teams","hooks_url":"https://api.github.com/repos/bem-incubator/bem-config/hooks","issue_events_url":"https://api.github.com/repos/bem-incubator/bem-config/issues/events{/number}","events_url":"https://api.github.com/repos/bem-incubator/bem-config/events","assignees_url":"https://api.github.com/repos/bem-incubator/bem-config/assignees{/user}","branches_url":"https://api.github.com/repos/bem-incubator/bem-config/branches{/branch}","tags_url":"https://api.github.com/repos/bem-incubator/bem-config/tags","blobs_url":"https://api.github.com/repos/bem-incubator/bem-config/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bem-incubator/bem-config/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bem-incubator/bem-config/git/refs{/sha}","trees_url":"https://api.github.com/repos/bem-incubator/bem-config/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bem-incubator/bem-config/statuses/{sha}","languages_url":"https://api.github.com/repos/bem-incubator/bem-config/languages","stargazers_url":"https://api.github.com/repos/bem-incubator/bem-config/stargazers","contributors_url":"https://api.github.com/repos/bem-incubator/bem-config/contributors","subscribers_url":"https://api.github.com/repos/bem-incubator/bem-config/subscribers","subscription_url":"https://api.github.com/repos/bem-incubator/bem-config/subscription","commits_url":"https://api.github.com/repos/bem-incubator/bem-config/commits{/sha}","git_commits_url":"https://api.github.com/repos/bem-incubator/bem-config/git/commits{/sha}","comments_url":"https://api.github.com/repos/bem-incubator/bem-config/comments{/number}","issue_comment_url":"https://api.github.com/repos/bem-incubator/bem-config/issues/comments{/number}","contents_url":"https://api.github.com/repos/bem-incubator/bem-config/contents/{+path}","compare_url":"https://api.github.com/repos/bem-incubator/bem-config/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bem-incubator/bem-config/merges","archive_url":"https://api.github.com/repos/bem-incubator/bem-config/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bem-incubator/bem-config/downloads","issues_url":"https://api.github.com/repos/bem-incubator/bem-config/issues{/number}","pulls_url":"https://api.github.com/repos/bem-incubator/bem-config/pulls{/number}","milestones_url":"https://api.github.com/repos/bem-incubator/bem-config/milestones{/number}","notifications_url":"https://api.github.com/repos/bem-incubator/bem-config/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bem-incubator/bem-config/labels{/name}","releases_url":"https://api.github.com/repos/bem-incubator/bem-config/releases{/id}","created_at":"2015-12-12T15:07:13Z","updated_at":"2015-12-12T17:50:27Z","pushed_at":"2015-12-12T20:27:41Z","git_url":"git://github.com/bem-incubator/bem-config.git","ssh_url":"git@github.com:bem-incubator/bem-config.git","clone_url":"https://github.com/bem-incubator/bem-config.git","svn_url":"https://github.com/bem-incubator/bem-config","homepage":null,"size":8,"stargazers_count":1,"watchers_count":1,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":1,"default_branch":"master"}},"base":{"label":"bem-incubator:master","ref":"master","sha":"17dc1cc0a7dd842ae83ddac530837011dd113cbe","user":{"login":"bem-incubator","id":10929504,"avatar_url":"https://avatars.githubusercontent.com/u/10929504?v=3","gravatar_id":"","url":"https://api.github.com/users/bem-incubator","html_url":"https://github.com/bem-incubator","followers_url":"https://api.github.com/users/bem-incubator/followers","following_url":"https://api.github.com/users/bem-incubator/following{/other_user}","gists_url":"https://api.github.com/users/bem-incubator/gists{/gist_id}","starred_url":"https://api.github.com/users/bem-incubator/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bem-incubator/subscriptions","organizations_url":"https://api.github.com/users/bem-incubator/orgs","repos_url":"https://api.github.com/users/bem-incubator/repos","events_url":"https://api.github.com/users/bem-incubator/events{/privacy}","received_events_url":"https://api.github.com/users/bem-incubator/received_events","type":"Organization","site_admin":false},"repo":{"id":47882576,"name":"bem-config","full_name":"bem-incubator/bem-config","owner":{"login":"bem-incubator","id":10929504,"avatar_url":"https://avatars.githubusercontent.com/u/10929504?v=3","gravatar_id":"","url":"https://api.github.com/users/bem-incubator","html_url":"https://github.com/bem-incubator","followers_url":"https://api.github.com/users/bem-incubator/followers","following_url":"https://api.github.com/users/bem-incubator/following{/other_user}","gists_url":"https://api.github.com/users/bem-incubator/gists{/gist_id}","starred_url":"https://api.github.com/users/bem-incubator/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bem-incubator/subscriptions","organizations_url":"https://api.github.com/users/bem-incubator/orgs","repos_url":"https://api.github.com/users/bem-incubator/repos","events_url":"https://api.github.com/users/bem-incubator/events{/privacy}","received_events_url":"https://api.github.com/users/bem-incubator/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/bem-incubator/bem-config","description":"Config module for bem-tools","fork":false,"url":"https://api.github.com/repos/bem-incubator/bem-config","forks_url":"https://api.github.com/repos/bem-incubator/bem-config/forks","keys_url":"https://api.github.com/repos/bem-incubator/bem-config/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bem-incubator/bem-config/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bem-incubator/bem-config/teams","hooks_url":"https://api.github.com/repos/bem-incubator/bem-config/hooks","issue_events_url":"https://api.github.com/repos/bem-incubator/bem-config/issues/events{/number}","events_url":"https://api.github.com/repos/bem-incubator/bem-config/events","assignees_url":"https://api.github.com/repos/bem-incubator/bem-config/assignees{/user}","branches_url":"https://api.github.com/repos/bem-incubator/bem-config/branches{/branch}","tags_url":"https://api.github.com/repos/bem-incubator/bem-config/tags","blobs_url":"https://api.github.com/repos/bem-incubator/bem-config/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bem-incubator/bem-config/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bem-incubator/bem-config/git/refs{/sha}","trees_url":"https://api.github.com/repos/bem-incubator/bem-config/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bem-incubator/bem-config/statuses/{sha}","languages_url":"https://api.github.com/repos/bem-incubator/bem-config/languages","stargazers_url":"https://api.github.com/repos/bem-incubator/bem-config/stargazers","contributors_url":"https://api.github.com/repos/bem-incubator/bem-config/contributors","subscribers_url":"https://api.github.com/repos/bem-incubator/bem-config/subscribers","subscription_url":"https://api.github.com/repos/bem-incubator/bem-config/subscription","commits_url":"https://api.github.com/repos/bem-incubator/bem-config/commits{/sha}","git_commits_url":"https://api.github.com/repos/bem-incubator/bem-config/git/commits{/sha}","comments_url":"https://api.github.com/repos/bem-incubator/bem-config/comments{/number}","issue_comment_url":"https://api.github.com/repos/bem-incubator/bem-config/issues/comments{/number}","contents_url":"https://api.github.com/repos/bem-incubator/bem-config/contents/{+path}","compare_url":"https://api.github.com/repos/bem-incubator/bem-config/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bem-incubator/bem-config/merges","archive_url":"https://api.github.com/repos/bem-incubator/bem-config/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bem-incubator/bem-config/downloads","issues_url":"https://api.github.com/repos/bem-incubator/bem-config/issues{/number}","pulls_url":"https://api.github.com/repos/bem-incubator/bem-config/pulls{/number}","milestones_url":"https://api.github.com/repos/bem-incubator/bem-config/milestones{/number}","notifications_url":"https://api.github.com/repos/bem-incubator/bem-config/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bem-incubator/bem-config/labels{/name}","releases_url":"https://api.github.com/repos/bem-incubator/bem-config/releases{/id}","created_at":"2015-12-12T15:07:13Z","updated_at":"2015-12-12T17:50:27Z","pushed_at":"2015-12-12T20:27:41Z","git_url":"git://github.com/bem-incubator/bem-config.git","ssh_url":"git@github.com:bem-incubator/bem-config.git","clone_url":"https://github.com/bem-incubator/bem-config.git","svn_url":"https://github.com/bem-incubator/bem-config","homepage":null,"size":8,"stargazers_count":1,"watchers_count":1,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/bem-incubator/bem-config/pulls/1"},"html":{"href":"https://github.com/bem-incubator/bem-config/pull/1"},"issue":{"href":"https://api.github.com/repos/bem-incubator/bem-config/issues/1"},"comments":{"href":"https://api.github.com/repos/bem-incubator/bem-config/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/bem-incubator/bem-config/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/bem-incubator/bem-config/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/bem-incubator/bem-config/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/bem-incubator/bem-config/statuses/98be560d5da3ecf0b21eaad338a51876893e3161"}}}}