{"action":"opened","number":5385,"pull_request":{"url":"https://api.github.com/repos/yarnpkg/yarn/pulls/5385","id":170359040,"html_url":"https://github.com/yarnpkg/yarn/pull/5385","diff_url":"https://github.com/yarnpkg/yarn/pull/5385.diff","patch_url":"https://github.com/yarnpkg/yarn/pull/5385.patch","issue_url":"https://api.github.com/repos/yarnpkg/yarn/issues/5385","number":5385,"state":"open","locked":false,"title":"Fix test for `yarn licenses generate-disclaimer` output","user":{"login":"sth","id":950517,"avatar_url":"https://avatars0.githubusercontent.com/u/950517?v=4","gravatar_id":"","url":"https://api.github.com/users/sth","html_url":"https://github.com/sth","followers_url":"https://api.github.com/users/sth/followers","following_url":"https://api.github.com/users/sth/following{/other_user}","gists_url":"https://api.github.com/users/sth/gists{/gist_id}","starred_url":"https://api.github.com/users/sth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sth/subscriptions","organizations_url":"https://api.github.com/users/sth/orgs","repos_url":"https://api.github.com/users/sth/repos","events_url":"https://api.github.com/users/sth/events{/privacy}","received_events_url":"https://api.github.com/users/sth/received_events","type":"User","site_admin":false},"body":"**Summary**\r\n\r\nThere is [a test][testcase] that attempts to test that license files are show correctly for `yarn licenses generate-disclaimer`. The test currently just prints the license files to the console and doesn't verify what was printed. This pull request modifies the test to not show unwanted output during testing and to actually test that the output is correct.\r\n\r\n**Implementation**\r\n\r\nThe normal method of capturing output isn't sufficient to capture the output of `yarn licenses generate-disclaimer`, since that command [intentionally][1] uses `console.log()` directly. Because of this a special helper function is used that mocks `console.log()` and lets the test verify what was written.\r\n\r\n**Test plan**\r\n\r\nThe `licenses.js.snap`, which is used to verify the commands output, now contains the license text we expect to be printed. The test passes using this .snap file.\r\n\r\n**Additional change**\r\n\r\nI also renamed the \"lists all licenses of the dependencies with the --json argument\" test in the same file because it doesn't seem to involve any --json argument.\r\n\r\n  [testcase]: https://github.com/yarnpkg/yarn/blob/1a4e9ff4128b3aefe6b57e77a3456813dea6f28a/__tests__/commands/licenses.js#L28\r\n  [1]: https://github.com/yarnpkg/yarn/blob/1a4e9ff4128b3aefe6b57e77a3456813dea6f28a/src/cli/commands/licenses.js#L137","created_at":"2018-02-21T02:01:27Z","updated_at":"2018-02-21T02:01:27Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/yarnpkg/yarn/pulls/5385/commits","review_comments_url":"https://api.github.com/repos/yarnpkg/yarn/pulls/5385/comments","review_comment_url":"https://api.github.com/repos/yarnpkg/yarn/pulls/comments{/number}","comments_url":"https://api.github.com/repos/yarnpkg/yarn/issues/5385/comments","statuses_url":"https://api.github.com/repos/yarnpkg/yarn/statuses/c375dd1a22cbf74a9fd07d72f1fcb9bc87cae7b0","head":{"label":"sth:tests-capture-license-output","ref":"tests-capture-license-output","sha":"c375dd1a22cbf74a9fd07d72f1fcb9bc87cae7b0","user":{"login":"sth","id":950517,"avatar_url":"https://avatars0.githubusercontent.com/u/950517?v=4","gravatar_id":"","url":"https://api.github.com/users/sth","html_url":"https://github.com/sth","followers_url":"https://api.github.com/users/sth/followers","following_url":"https://api.github.com/users/sth/following{/other_user}","gists_url":"https://api.github.com/users/sth/gists{/gist_id}","starred_url":"https://api.github.com/users/sth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sth/subscriptions","organizations_url":"https://api.github.com/users/sth/orgs","repos_url":"https://api.github.com/users/sth/repos","events_url":"https://api.github.com/users/sth/events{/privacy}","received_events_url":"https://api.github.com/users/sth/received_events","type":"User","site_admin":false},"repo":{"id":94355429,"name":"yarn","full_name":"sth/yarn","owner":{"login":"sth","id":950517,"avatar_url":"https://avatars0.githubusercontent.com/u/950517?v=4","gravatar_id":"","url":"https://api.github.com/users/sth","html_url":"https://github.com/sth","followers_url":"https://api.github.com/users/sth/followers","following_url":"https://api.github.com/users/sth/following{/other_user}","gists_url":"https://api.github.com/users/sth/gists{/gist_id}","starred_url":"https://api.github.com/users/sth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sth/subscriptions","organizations_url":"https://api.github.com/users/sth/orgs","repos_url":"https://api.github.com/users/sth/repos","events_url":"https://api.github.com/users/sth/events{/privacy}","received_events_url":"https://api.github.com/users/sth/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/sth/yarn","description":"📦🐈 Fast, reliable, and secure dependency management.","fork":true,"url":"https://api.github.com/repos/sth/yarn","forks_url":"https://api.github.com/repos/sth/yarn/forks","keys_url":"https://api.github.com/repos/sth/yarn/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sth/yarn/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sth/yarn/teams","hooks_url":"https://api.github.com/repos/sth/yarn/hooks","issue_events_url":"https://api.github.com/repos/sth/yarn/issues/events{/number}","events_url":"https://api.github.com/repos/sth/yarn/events","assignees_url":"https://api.github.com/repos/sth/yarn/assignees{/user}","branches_url":"https://api.github.com/repos/sth/yarn/branches{/branch}","tags_url":"https://api.github.com/repos/sth/yarn/tags","blobs_url":"https://api.github.com/repos/sth/yarn/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sth/yarn/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sth/yarn/git/refs{/sha}","trees_url":"https://api.github.com/repos/sth/yarn/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sth/yarn/statuses/{sha}","languages_url":"https://api.github.com/repos/sth/yarn/languages","stargazers_url":"https://api.github.com/repos/sth/yarn/stargazers","contributors_url":"https://api.github.com/repos/sth/yarn/contributors","subscribers_url":"https://api.github.com/repos/sth/yarn/subscribers","subscription_url":"https://api.github.com/repos/sth/yarn/subscription","commits_url":"https://api.github.com/repos/sth/yarn/commits{/sha}","git_commits_url":"https://api.github.com/repos/sth/yarn/git/commits{/sha}","comments_url":"https://api.github.com/repos/sth/yarn/comments{/number}","issue_comment_url":"https://api.github.com/repos/sth/yarn/issues/comments{/number}","contents_url":"https://api.github.com/repos/sth/yarn/contents/{+path}","compare_url":"https://api.github.com/repos/sth/yarn/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sth/yarn/merges","archive_url":"https://api.github.com/repos/sth/yarn/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sth/yarn/downloads","issues_url":"https://api.github.com/repos/sth/yarn/issues{/number}","pulls_url":"https://api.github.com/repos/sth/yarn/pulls{/number}","milestones_url":"https://api.github.com/repos/sth/yarn/milestones{/number}","notifications_url":"https://api.github.com/repos/sth/yarn/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sth/yarn/labels{/name}","releases_url":"https://api.github.com/repos/sth/yarn/releases{/id}","deployments_url":"https://api.github.com/repos/sth/yarn/deployments","created_at":"2017-06-14T17:17:16Z","updated_at":"2017-06-14T17:17:22Z","pushed_at":"2018-02-21T01:10:18Z","git_url":"git://github.com/sth/yarn.git","ssh_url":"git@github.com:sth/yarn.git","clone_url":"https://github.com/sth/yarn.git","svn_url":"https://github.com/sth/yarn","homepage":"https://yarnpkg.com","size":114503,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"yarnpkg:master","ref":"master","sha":"1a4e9ff4128b3aefe6b57e77a3456813dea6f28a","user":{"login":"yarnpkg","id":22247014,"avatar_url":"https://avatars3.githubusercontent.com/u/22247014?v=4","gravatar_id":"","url":"https://api.github.com/users/yarnpkg","html_url":"https://github.com/yarnpkg","followers_url":"https://api.github.com/users/yarnpkg/followers","following_url":"https://api.github.com/users/yarnpkg/following{/other_user}","gists_url":"https://api.github.com/users/yarnpkg/gists{/gist_id}","starred_url":"https://api.github.com/users/yarnpkg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yarnpkg/subscriptions","organizations_url":"https://api.github.com/users/yarnpkg/orgs","repos_url":"https://api.github.com/users/yarnpkg/repos","events_url":"https://api.github.com/users/yarnpkg/events{/privacy}","received_events_url":"https://api.github.com/users/yarnpkg/received_events","type":"Organization","site_admin":false},"repo":{"id":49970642,"name":"yarn","full_name":"yarnpkg/yarn","owner":{"login":"yarnpkg","id":22247014,"avatar_url":"https://avatars3.githubusercontent.com/u/22247014?v=4","gravatar_id":"","url":"https://api.github.com/users/yarnpkg","html_url":"https://github.com/yarnpkg","followers_url":"https://api.github.com/users/yarnpkg/followers","following_url":"https://api.github.com/users/yarnpkg/following{/other_user}","gists_url":"https://api.github.com/users/yarnpkg/gists{/gist_id}","starred_url":"https://api.github.com/users/yarnpkg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yarnpkg/subscriptions","organizations_url":"https://api.github.com/users/yarnpkg/orgs","repos_url":"https://api.github.com/users/yarnpkg/repos","events_url":"https://api.github.com/users/yarnpkg/events{/privacy}","received_events_url":"https://api.github.com/users/yarnpkg/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/yarnpkg/yarn","description":"📦🐈 Fast, reliable, and secure dependency management.","fork":false,"url":"https://api.github.com/repos/yarnpkg/yarn","forks_url":"https://api.github.com/repos/yarnpkg/yarn/forks","keys_url":"https://api.github.com/repos/yarnpkg/yarn/keys{/key_id}","collaborators_url":"https://api.github.com/repos/yarnpkg/yarn/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/yarnpkg/yarn/teams","hooks_url":"https://api.github.com/repos/yarnpkg/yarn/hooks","issue_events_url":"https://api.github.com/repos/yarnpkg/yarn/issues/events{/number}","events_url":"https://api.github.com/repos/yarnpkg/yarn/events","assignees_url":"https://api.github.com/repos/yarnpkg/yarn/assignees{/user}","branches_url":"https://api.github.com/repos/yarnpkg/yarn/branches{/branch}","tags_url":"https://api.github.com/repos/yarnpkg/yarn/tags","blobs_url":"https://api.github.com/repos/yarnpkg/yarn/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/yarnpkg/yarn/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/yarnpkg/yarn/git/refs{/sha}","trees_url":"https://api.github.com/repos/yarnpkg/yarn/git/trees{/sha}","statuses_url":"https://api.github.com/repos/yarnpkg/yarn/statuses/{sha}","languages_url":"https://api.github.com/repos/yarnpkg/yarn/languages","stargazers_url":"https://api.github.com/repos/yarnpkg/yarn/stargazers","contributors_url":"https://api.github.com/repos/yarnpkg/yarn/contributors","subscribers_url":"https://api.github.com/repos/yarnpkg/yarn/subscribers","subscription_url":"https://api.github.com/repos/yarnpkg/yarn/subscription","commits_url":"https://api.github.com/repos/yarnpkg/yarn/commits{/sha}","git_commits_url":"https://api.github.com/repos/yarnpkg/yarn/git/commits{/sha}","comments_url":"https://api.github.com/repos/yarnpkg/yarn/comments{/number}","issue_comment_url":"https://api.github.com/repos/yarnpkg/yarn/issues/comments{/number}","contents_url":"https://api.github.com/repos/yarnpkg/yarn/contents/{+path}","compare_url":"https://api.github.com/repos/yarnpkg/yarn/compare/{base}...{head}","merges_url":"https://api.github.com/repos/yarnpkg/yarn/merges","archive_url":"https://api.github.com/repos/yarnpkg/yarn/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/yarnpkg/yarn/downloads","issues_url":"https://api.github.com/repos/yarnpkg/yarn/issues{/number}","pulls_url":"https://api.github.com/repos/yarnpkg/yarn/pulls{/number}","milestones_url":"https://api.github.com/repos/yarnpkg/yarn/milestones{/number}","notifications_url":"https://api.github.com/repos/yarnpkg/yarn/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/yarnpkg/yarn/labels{/name}","releases_url":"https://api.github.com/repos/yarnpkg/yarn/releases{/id}","deployments_url":"https://api.github.com/repos/yarnpkg/yarn/deployments","created_at":"2016-01-19T17:39:16Z","updated_at":"2018-02-21T01:36:35Z","pushed_at":"2018-02-21T01:28:05Z","git_url":"git://github.com/yarnpkg/yarn.git","ssh_url":"git@github.com:yarnpkg/yarn.git","clone_url":"https://github.com/yarnpkg/yarn.git","svn_url":"https://github.com/yarnpkg/yarn","homepage":"https://yarnpkg.com","size":115098,"stargazers_count":30263,"watchers_count":30263,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1660,"mirror_url":null,"archived":false,"open_issues_count":1040,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":1660,"open_issues":1040,"watchers":30263,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/yarnpkg/yarn/pulls/5385"},"html":{"href":"https://github.com/yarnpkg/yarn/pull/5385"},"issue":{"href":"https://api.github.com/repos/yarnpkg/yarn/issues/5385"},"comments":{"href":"https://api.github.com/repos/yarnpkg/yarn/issues/5385/comments"},"review_comments":{"href":"https://api.github.com/repos/yarnpkg/yarn/pulls/5385/comments"},"review_comment":{"href":"https://api.github.com/repos/yarnpkg/yarn/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/yarnpkg/yarn/pulls/5385/commits"},"statuses":{"href":"https://api.github.com/repos/yarnpkg/yarn/statuses/c375dd1a22cbf74a9fd07d72f1fcb9bc87cae7b0"}},"author_association":"CONTRIBUTOR","merged":false,"mergeable":null,"rebaseable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"maintainer_can_modify":true,"commits":3,"additions":76,"deletions":6,"changed_files":2}}
{"actor":{"display_login":"sth"}}