{"action":"created","comment":{"url":"https://api.github.com/repos/bcoe/nyc/pulls/comments/48753436","id":48753436,"diff_hunk":"@@ -27,12 +29,22 @@ function NYC (opts) {\n   this._istanbul = opts.istanbul\n   this.subprocessBin = opts.subprocessBin || path.resolve(__dirname, './bin/nyc.js')\n   this._tempDirectory = opts.tempDirectory || './.nyc_output'\n-  this.cwd = opts.cwd || process.env.NYC_CWD || process.cwd()\n-  this.reporter = arrify(opts.reporter || 'text')\n+\n+  var cwd = opts.cwd || process.env.NYC_CWD || process.cwd()\n+  var pkgPath = pkgUp.sync(cwd)\n \n   // you can specify config in the nyc stanza of package.json.\n-  var config = require(path.resolve(this.cwd, './package.json')).config || {}\n-  config = config.nyc || {}\n+  var config\n+  if (pkgPath) {","path":"index.js","position":23,"original_position":23,"commit_id":"9a1bdedb00c530d8284c9e2a0754b76ebba5c004","original_commit_id":"9a1bdedb00c530d8284c9e2a0754b76ebba5c004","user":{"login":"bcoe","id":194609,"avatar_url":"https://avatars.githubusercontent.com/u/194609?v=3","gravatar_id":"","url":"https://api.github.com/users/bcoe","html_url":"https://github.com/bcoe","followers_url":"https://api.github.com/users/bcoe/followers","following_url":"https://api.github.com/users/bcoe/following{/other_user}","gists_url":"https://api.github.com/users/bcoe/gists{/gist_id}","starred_url":"https://api.github.com/users/bcoe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bcoe/subscriptions","organizations_url":"https://api.github.com/users/bcoe/orgs","repos_url":"https://api.github.com/users/bcoe/repos","events_url":"https://api.github.com/users/bcoe/events{/privacy}","received_events_url":"https://api.github.com/users/bcoe/received_events","type":"User","site_admin":false},"body":"the constructor is getting pretty verbose at this point, mind moving the config logic into a private method, e.g., `_loadConfig`.","created_at":"2016-01-04T17:06:48Z","updated_at":"2016-01-04T17:06:48Z","html_url":"https://github.com/bcoe/nyc/pull/132#discussion_r48753436","pull_request_url":"https://api.github.com/repos/bcoe/nyc/pulls/132","_links":{"self":{"href":"https://api.github.com/repos/bcoe/nyc/pulls/comments/48753436"},"html":{"href":"https://github.com/bcoe/nyc/pull/132#discussion_r48753436"},"pull_request":{"href":"https://api.github.com/repos/bcoe/nyc/pulls/132"}}},"pull_request":{"url":"https://api.github.com/repos/bcoe/nyc/pulls/132","id":54947564,"html_url":"https://github.com/bcoe/nyc/pull/132","diff_url":"https://github.com/bcoe/nyc/pull/132.diff","patch_url":"https://github.com/bcoe/nyc/pull/132.patch","issue_url":"https://api.github.com/repos/bcoe/nyc/issues/132","number":132,"state":"open","locked":false,"title":"Use `nyc` instead of `config.nyc` in package.json","user":{"login":"jamestalmage","id":4082216,"avatar_url":"https://avatars.githubusercontent.com/u/4082216?v=3","gravatar_id":"","url":"https://api.github.com/users/jamestalmage","html_url":"https://github.com/jamestalmage","followers_url":"https://api.github.com/users/jamestalmage/followers","following_url":"https://api.github.com/users/jamestalmage/following{/other_user}","gists_url":"https://api.github.com/users/jamestalmage/gists{/gist_id}","starred_url":"https://api.github.com/users/jamestalmage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jamestalmage/subscriptions","organizations_url":"https://api.github.com/users/jamestalmage/orgs","repos_url":"https://api.github.com/users/jamestalmage/repos","events_url":"https://api.github.com/users/jamestalmage/events{/privacy}","received_events_url":"https://api.github.com/users/jamestalmage/received_events","type":"User","site_admin":false},"body":"Fixes #131\n\nThis also uses `pkg-up` to locate the nearest `package.json` from `cwd`, and will move `cwd` to there. This allows you to invoke `nyc` from a subdirectory of your project and still have it behave as expected.  This is something our caching mechanism already does. If it can't find a `package.json`, it just uses the original `cwd` option.","created_at":"2016-01-04T06:51:02Z","updated_at":"2016-01-04T17:06:48Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b675bf378dda03bc2c11ded43ed48e7f2d89f8ef","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/bcoe/nyc/pulls/132/commits","review_comments_url":"https://api.github.com/repos/bcoe/nyc/pulls/132/comments","review_comment_url":"https://api.github.com/repos/bcoe/nyc/pulls/comments{/number}","comments_url":"https://api.github.com/repos/bcoe/nyc/issues/132/comments","statuses_url":"https://api.github.com/repos/bcoe/nyc/statuses/9a1bdedb00c530d8284c9e2a0754b76ebba5c004","head":{"label":"jamestalmage:use-top-level-nyc-config-in-pkg-json","ref":"use-top-level-nyc-config-in-pkg-json","sha":"9a1bdedb00c530d8284c9e2a0754b76ebba5c004","user":{"login":"jamestalmage","id":4082216,"avatar_url":"https://avatars.githubusercontent.com/u/4082216?v=3","gravatar_id":"","url":"https://api.github.com/users/jamestalmage","html_url":"https://github.com/jamestalmage","followers_url":"https://api.github.com/users/jamestalmage/followers","following_url":"https://api.github.com/users/jamestalmage/following{/other_user}","gists_url":"https://api.github.com/users/jamestalmage/gists{/gist_id}","starred_url":"https://api.github.com/users/jamestalmage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jamestalmage/subscriptions","organizations_url":"https://api.github.com/users/jamestalmage/orgs","repos_url":"https://api.github.com/users/jamestalmage/repos","events_url":"https://api.github.com/users/jamestalmage/events{/privacy}","received_events_url":"https://api.github.com/users/jamestalmage/received_events","type":"User","site_admin":false},"repo":{"id":47446857,"name":"nyc","full_name":"jamestalmage/nyc","owner":{"login":"jamestalmage","id":4082216,"avatar_url":"https://avatars.githubusercontent.com/u/4082216?v=3","gravatar_id":"","url":"https://api.github.com/users/jamestalmage","html_url":"https://github.com/jamestalmage","followers_url":"https://api.github.com/users/jamestalmage/followers","following_url":"https://api.github.com/users/jamestalmage/following{/other_user}","gists_url":"https://api.github.com/users/jamestalmage/gists{/gist_id}","starred_url":"https://api.github.com/users/jamestalmage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jamestalmage/subscriptions","organizations_url":"https://api.github.com/users/jamestalmage/orgs","repos_url":"https://api.github.com/users/jamestalmage/repos","events_url":"https://api.github.com/users/jamestalmage/events{/privacy}","received_events_url":"https://api.github.com/users/jamestalmage/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jamestalmage/nyc","description":"a code coverage tool that works well with subprocesses.","fork":true,"url":"https://api.github.com/repos/jamestalmage/nyc","forks_url":"https://api.github.com/repos/jamestalmage/nyc/forks","keys_url":"https://api.github.com/repos/jamestalmage/nyc/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jamestalmage/nyc/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jamestalmage/nyc/teams","hooks_url":"https://api.github.com/repos/jamestalmage/nyc/hooks","issue_events_url":"https://api.github.com/repos/jamestalmage/nyc/issues/events{/number}","events_url":"https://api.github.com/repos/jamestalmage/nyc/events","assignees_url":"https://api.github.com/repos/jamestalmage/nyc/assignees{/user}","branches_url":"https://api.github.com/repos/jamestalmage/nyc/branches{/branch}","tags_url":"https://api.github.com/repos/jamestalmage/nyc/tags","blobs_url":"https://api.github.com/repos/jamestalmage/nyc/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jamestalmage/nyc/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jamestalmage/nyc/git/refs{/sha}","trees_url":"https://api.github.com/repos/jamestalmage/nyc/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jamestalmage/nyc/statuses/{sha}","languages_url":"https://api.github.com/repos/jamestalmage/nyc/languages","stargazers_url":"https://api.github.com/repos/jamestalmage/nyc/stargazers","contributors_url":"https://api.github.com/repos/jamestalmage/nyc/contributors","subscribers_url":"https://api.github.com/repos/jamestalmage/nyc/subscribers","subscription_url":"https://api.github.com/repos/jamestalmage/nyc/subscription","commits_url":"https://api.github.com/repos/jamestalmage/nyc/commits{/sha}","git_commits_url":"https://api.github.com/repos/jamestalmage/nyc/git/commits{/sha}","comments_url":"https://api.github.com/repos/jamestalmage/nyc/comments{/number}","issue_comment_url":"https://api.github.com/repos/jamestalmage/nyc/issues/comments{/number}","contents_url":"https://api.github.com/repos/jamestalmage/nyc/contents/{+path}","compare_url":"https://api.github.com/repos/jamestalmage/nyc/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jamestalmage/nyc/merges","archive_url":"https://api.github.com/repos/jamestalmage/nyc/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jamestalmage/nyc/downloads","issues_url":"https://api.github.com/repos/jamestalmage/nyc/issues{/number}","pulls_url":"https://api.github.com/repos/jamestalmage/nyc/pulls{/number}","milestones_url":"https://api.github.com/repos/jamestalmage/nyc/milestones{/number}","notifications_url":"https://api.github.com/repos/jamestalmage/nyc/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jamestalmage/nyc/labels{/name}","releases_url":"https://api.github.com/repos/jamestalmage/nyc/releases{/id}","created_at":"2015-12-05T07:29:02Z","updated_at":"2015-12-05T07:29:03Z","pushed_at":"2016-01-04T06:50:51Z","git_url":"git://github.com/jamestalmage/nyc.git","ssh_url":"git@github.com:jamestalmage/nyc.git","clone_url":"https://github.com/jamestalmage/nyc.git","svn_url":"https://github.com/jamestalmage/nyc","homepage":"","size":475,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"bcoe:master","ref":"master","sha":"a1e98cda80040ae5c2ed8c6fbdf67bfb9d64ee94","user":{"login":"bcoe","id":194609,"avatar_url":"https://avatars.githubusercontent.com/u/194609?v=3","gravatar_id":"","url":"https://api.github.com/users/bcoe","html_url":"https://github.com/bcoe","followers_url":"https://api.github.com/users/bcoe/followers","following_url":"https://api.github.com/users/bcoe/following{/other_user}","gists_url":"https://api.github.com/users/bcoe/gists{/gist_id}","starred_url":"https://api.github.com/users/bcoe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bcoe/subscriptions","organizations_url":"https://api.github.com/users/bcoe/orgs","repos_url":"https://api.github.com/users/bcoe/repos","events_url":"https://api.github.com/users/bcoe/events{/privacy}","received_events_url":"https://api.github.com/users/bcoe/received_events","type":"User","site_admin":false},"repo":{"id":35312458,"name":"nyc","full_name":"bcoe/nyc","owner":{"login":"bcoe","id":194609,"avatar_url":"https://avatars.githubusercontent.com/u/194609?v=3","gravatar_id":"","url":"https://api.github.com/users/bcoe","html_url":"https://github.com/bcoe","followers_url":"https://api.github.com/users/bcoe/followers","following_url":"https://api.github.com/users/bcoe/following{/other_user}","gists_url":"https://api.github.com/users/bcoe/gists{/gist_id}","starred_url":"https://api.github.com/users/bcoe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bcoe/subscriptions","organizations_url":"https://api.github.com/users/bcoe/orgs","repos_url":"https://api.github.com/users/bcoe/repos","events_url":"https://api.github.com/users/bcoe/events{/privacy}","received_events_url":"https://api.github.com/users/bcoe/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/bcoe/nyc","description":"a code coverage tool that works well with subprocesses.","fork":false,"url":"https://api.github.com/repos/bcoe/nyc","forks_url":"https://api.github.com/repos/bcoe/nyc/forks","keys_url":"https://api.github.com/repos/bcoe/nyc/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bcoe/nyc/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bcoe/nyc/teams","hooks_url":"https://api.github.com/repos/bcoe/nyc/hooks","issue_events_url":"https://api.github.com/repos/bcoe/nyc/issues/events{/number}","events_url":"https://api.github.com/repos/bcoe/nyc/events","assignees_url":"https://api.github.com/repos/bcoe/nyc/assignees{/user}","branches_url":"https://api.github.com/repos/bcoe/nyc/branches{/branch}","tags_url":"https://api.github.com/repos/bcoe/nyc/tags","blobs_url":"https://api.github.com/repos/bcoe/nyc/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bcoe/nyc/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bcoe/nyc/git/refs{/sha}","trees_url":"https://api.github.com/repos/bcoe/nyc/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bcoe/nyc/statuses/{sha}","languages_url":"https://api.github.com/repos/bcoe/nyc/languages","stargazers_url":"https://api.github.com/repos/bcoe/nyc/stargazers","contributors_url":"https://api.github.com/repos/bcoe/nyc/contributors","subscribers_url":"https://api.github.com/repos/bcoe/nyc/subscribers","subscription_url":"https://api.github.com/repos/bcoe/nyc/subscription","commits_url":"https://api.github.com/repos/bcoe/nyc/commits{/sha}","git_commits_url":"https://api.github.com/repos/bcoe/nyc/git/commits{/sha}","comments_url":"https://api.github.com/repos/bcoe/nyc/comments{/number}","issue_comment_url":"https://api.github.com/repos/bcoe/nyc/issues/comments{/number}","contents_url":"https://api.github.com/repos/bcoe/nyc/contents/{+path}","compare_url":"https://api.github.com/repos/bcoe/nyc/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bcoe/nyc/merges","archive_url":"https://api.github.com/repos/bcoe/nyc/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bcoe/nyc/downloads","issues_url":"https://api.github.com/repos/bcoe/nyc/issues{/number}","pulls_url":"https://api.github.com/repos/bcoe/nyc/pulls{/number}","milestones_url":"https://api.github.com/repos/bcoe/nyc/milestones{/number}","notifications_url":"https://api.github.com/repos/bcoe/nyc/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bcoe/nyc/labels{/name}","releases_url":"https://api.github.com/repos/bcoe/nyc/releases{/id}","created_at":"2015-05-09T02:55:45Z","updated_at":"2016-01-04T06:56:28Z","pushed_at":"2016-01-04T06:51:03Z","git_url":"git://github.com/bcoe/nyc.git","ssh_url":"git@github.com:bcoe/nyc.git","clone_url":"https://github.com/bcoe/nyc.git","svn_url":"https://github.com/bcoe/nyc","homepage":"","size":531,"stargazers_count":178,"watchers_count":178,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":15,"mirror_url":null,"open_issues_count":14,"forks":15,"open_issues":14,"watchers":178,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/bcoe/nyc/pulls/132"},"html":{"href":"https://github.com/bcoe/nyc/pull/132"},"issue":{"href":"https://api.github.com/repos/bcoe/nyc/issues/132"},"comments":{"href":"https://api.github.com/repos/bcoe/nyc/issues/132/comments"},"review_comments":{"href":"https://api.github.com/repos/bcoe/nyc/pulls/132/comments"},"review_comment":{"href":"https://api.github.com/repos/bcoe/nyc/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/bcoe/nyc/pulls/132/commits"},"statuses":{"href":"https://api.github.com/repos/bcoe/nyc/statuses/9a1bdedb00c530d8284c9e2a0754b76ebba5c004"}}}}