{"action":"created","comment":{"url":"https://api.github.com/repos/airbnb/enzyme/pulls/comments/148925022","pull_request_review_id":74249179,"id":148925022,"diff_hunk":"@@ -0,0 +1,56 @@\n+#! /usr/bin/env node\n+/* eslint no-console: 0 */\n+\n+import shell from 'shelljs';\n+import semver from 'semver';\n+\n+const reactEnv = process.env.REACT;\n+const reactArg = process.argv[2];\n+\n+if (reactEnv && !semver.valid(reactEnv)) {\n+  throw new Error('REACT environment variable is not a valid semver');\n+}\n+\n+if (reactArg && !semver.valid(reactArg)) {\n+  throw new Error('Argument supplied to enzyme-adapter-react-install is not a valid semver');\n+}\n+\n+const reactVersion = reactEnv || reactArg;\n+\n+if (!semver.satisfies(reactVersion, '>=0.13')) {\n+  throw new Error('semver is not valid. Please provide a valid semver as an argument or environment variable.');\n+}\n+\n+console.log('Cleaning up React and related packages...');\n+if (shell.exec('npm uninstall --no-save react react-dom react-test-renderer react-addons-test-utils enzyme-adapter-react-14 enzyme-adapter-react-15.4 enzyme-adapter-react-15 enzyme-adapter-react-16 && rimraf node_modules/react-test-renderer node_modules/react && npm prune').code !== 0) {\n+  console.error('An uninstallation failed');\n+  shell.exit(1);\n+}\n+\n+console.log(`Installing React@${reactVersion} and related packages...`);\n+if (semver.satisfies(reactVersion, '^16.0.0-0')) {\n+  if (shell.exec('npm run install-peerdeps -S enzyme-adapter-react-16').code !== 0) {","path":"packages/enzyme-adapter-react-helper/src/enzyme-adapter-react-install.js","position":32,"original_position":32,"commit_id":"299d7af9eaf399b0a532b11ffe97b58b0baa20fa","original_commit_id":"299d7af9eaf399b0a532b11ffe97b58b0baa20fa","user":{"login":"ljharb","id":45469,"avatar_url":"https://avatars1.githubusercontent.com/u/45469?v=4","gravatar_id":"","url":"https://api.github.com/users/ljharb","html_url":"https://github.com/ljharb","followers_url":"https://api.github.com/users/ljharb/followers","following_url":"https://api.github.com/users/ljharb/following{/other_user}","gists_url":"https://api.github.com/users/ljharb/gists{/gist_id}","starred_url":"https://api.github.com/users/ljharb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ljharb/subscriptions","organizations_url":"https://api.github.com/users/ljharb/orgs","repos_url":"https://api.github.com/users/ljharb/repos","events_url":"https://api.github.com/users/ljharb/events{/privacy}","received_events_url":"https://api.github.com/users/ljharb/received_events","type":"User","site_admin":false},"body":"altho actually, i think we need to `require('npm-run')` and use it programmatically?","created_at":"2017-11-04T07:38:35Z","updated_at":"2017-11-04T07:38:35Z","html_url":"https://github.com/airbnb/enzyme/pull/1321#discussion_r148925022","pull_request_url":"https://api.github.com/repos/airbnb/enzyme/pulls/1321","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/airbnb/enzyme/pulls/comments/148925022"},"html":{"href":"https://github.com/airbnb/enzyme/pull/1321#discussion_r148925022"},"pull_request":{"href":"https://api.github.com/repos/airbnb/enzyme/pulls/1321"}},"in_reply_to_id":148924936},"pull_request":{"url":"https://api.github.com/repos/airbnb/enzyme/pulls/1321","id":150552048,"html_url":"https://github.com/airbnb/enzyme/pull/1321","diff_url":"https://github.com/airbnb/enzyme/pull/1321.diff","patch_url":"https://github.com/airbnb/enzyme/pull/1321.patch","issue_url":"https://api.github.com/repos/airbnb/enzyme/issues/1321","number":1321,"state":"open","locked":false,"title":"New Package: enzyme-adapter-react-helper","user":{"login":"brucewpaul","id":17549440,"avatar_url":"https://avatars2.githubusercontent.com/u/17549440?v=4","gravatar_id":"","url":"https://api.github.com/users/brucewpaul","html_url":"https://github.com/brucewpaul","followers_url":"https://api.github.com/users/brucewpaul/followers","following_url":"https://api.github.com/users/brucewpaul/following{/other_user}","gists_url":"https://api.github.com/users/brucewpaul/gists{/gist_id}","starred_url":"https://api.github.com/users/brucewpaul/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brucewpaul/subscriptions","organizations_url":"https://api.github.com/users/brucewpaul/orgs","repos_url":"https://api.github.com/users/brucewpaul/repos","events_url":"https://api.github.com/users/brucewpaul/events{/privacy}","received_events_url":"https://api.github.com/users/brucewpaul/received_events","type":"User","site_admin":false},"body":"This new package aims to help make testing with enzyme on multiple versions of React much easier by abstracting what needs to be installed depending on the version of React.\r\n\r\nThe idea would be that you would import this package and call `setupEnzymeAdapter(enzymeOptions, adapterOptions)` which will set up enzyme with the correct adapter.\r\n\r\nWhen using it on ci, you will either need to supply the `enzyme-adapter-react-install` script an argument with the correct semver (`enzyme-adapter-react-install 16.0.0`) or as an environment variable (`REACT=16.0.0 enzyme-adapter-react-install`). The environment variable takes precedent (if present) over the supplied argument.","created_at":"2017-11-03T15:09:21Z","updated_at":"2017-11-04T07:38:35Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3d150ec9678c7f96b2996f6b309cdf7043a01b31","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/airbnb/enzyme/pulls/1321/commits","review_comments_url":"https://api.github.com/repos/airbnb/enzyme/pulls/1321/comments","review_comment_url":"https://api.github.com/repos/airbnb/enzyme/pulls/comments{/number}","comments_url":"https://api.github.com/repos/airbnb/enzyme/issues/1321/comments","statuses_url":"https://api.github.com/repos/airbnb/enzyme/statuses/299d7af9eaf399b0a532b11ffe97b58b0baa20fa","head":{"label":"brucewpaul:bwp--adapter-helper","ref":"bwp--adapter-helper","sha":"299d7af9eaf399b0a532b11ffe97b58b0baa20fa","user":{"login":"brucewpaul","id":17549440,"avatar_url":"https://avatars2.githubusercontent.com/u/17549440?v=4","gravatar_id":"","url":"https://api.github.com/users/brucewpaul","html_url":"https://github.com/brucewpaul","followers_url":"https://api.github.com/users/brucewpaul/followers","following_url":"https://api.github.com/users/brucewpaul/following{/other_user}","gists_url":"https://api.github.com/users/brucewpaul/gists{/gist_id}","starred_url":"https://api.github.com/users/brucewpaul/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brucewpaul/subscriptions","organizations_url":"https://api.github.com/users/brucewpaul/orgs","repos_url":"https://api.github.com/users/brucewpaul/repos","events_url":"https://api.github.com/users/brucewpaul/events{/privacy}","received_events_url":"https://api.github.com/users/brucewpaul/received_events","type":"User","site_admin":false},"repo":{"id":105944114,"name":"enzyme","full_name":"brucewpaul/enzyme","owner":{"login":"brucewpaul","id":17549440,"avatar_url":"https://avatars2.githubusercontent.com/u/17549440?v=4","gravatar_id":"","url":"https://api.github.com/users/brucewpaul","html_url":"https://github.com/brucewpaul","followers_url":"https://api.github.com/users/brucewpaul/followers","following_url":"https://api.github.com/users/brucewpaul/following{/other_user}","gists_url":"https://api.github.com/users/brucewpaul/gists{/gist_id}","starred_url":"https://api.github.com/users/brucewpaul/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brucewpaul/subscriptions","organizations_url":"https://api.github.com/users/brucewpaul/orgs","repos_url":"https://api.github.com/users/brucewpaul/repos","events_url":"https://api.github.com/users/brucewpaul/events{/privacy}","received_events_url":"https://api.github.com/users/brucewpaul/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/brucewpaul/enzyme","description":"JavaScript Testing utilities for React","fork":true,"url":"https://api.github.com/repos/brucewpaul/enzyme","forks_url":"https://api.github.com/repos/brucewpaul/enzyme/forks","keys_url":"https://api.github.com/repos/brucewpaul/enzyme/keys{/key_id}","collaborators_url":"https://api.github.com/repos/brucewpaul/enzyme/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/brucewpaul/enzyme/teams","hooks_url":"https://api.github.com/repos/brucewpaul/enzyme/hooks","issue_events_url":"https://api.github.com/repos/brucewpaul/enzyme/issues/events{/number}","events_url":"https://api.github.com/repos/brucewpaul/enzyme/events","assignees_url":"https://api.github.com/repos/brucewpaul/enzyme/assignees{/user}","branches_url":"https://api.github.com/repos/brucewpaul/enzyme/branches{/branch}","tags_url":"https://api.github.com/repos/brucewpaul/enzyme/tags","blobs_url":"https://api.github.com/repos/brucewpaul/enzyme/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/brucewpaul/enzyme/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/brucewpaul/enzyme/git/refs{/sha}","trees_url":"https://api.github.com/repos/brucewpaul/enzyme/git/trees{/sha}","statuses_url":"https://api.github.com/repos/brucewpaul/enzyme/statuses/{sha}","languages_url":"https://api.github.com/repos/brucewpaul/enzyme/languages","stargazers_url":"https://api.github.com/repos/brucewpaul/enzyme/stargazers","contributors_url":"https://api.github.com/repos/brucewpaul/enzyme/contributors","subscribers_url":"https://api.github.com/repos/brucewpaul/enzyme/subscribers","subscription_url":"https://api.github.com/repos/brucewpaul/enzyme/subscription","commits_url":"https://api.github.com/repos/brucewpaul/enzyme/commits{/sha}","git_commits_url":"https://api.github.com/repos/brucewpaul/enzyme/git/commits{/sha}","comments_url":"https://api.github.com/repos/brucewpaul/enzyme/comments{/number}","issue_comment_url":"https://api.github.com/repos/brucewpaul/enzyme/issues/comments{/number}","contents_url":"https://api.github.com/repos/brucewpaul/enzyme/contents/{+path}","compare_url":"https://api.github.com/repos/brucewpaul/enzyme/compare/{base}...{head}","merges_url":"https://api.github.com/repos/brucewpaul/enzyme/merges","archive_url":"https://api.github.com/repos/brucewpaul/enzyme/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/brucewpaul/enzyme/downloads","issues_url":"https://api.github.com/repos/brucewpaul/enzyme/issues{/number}","pulls_url":"https://api.github.com/repos/brucewpaul/enzyme/pulls{/number}","milestones_url":"https://api.github.com/repos/brucewpaul/enzyme/milestones{/number}","notifications_url":"https://api.github.com/repos/brucewpaul/enzyme/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/brucewpaul/enzyme/labels{/name}","releases_url":"https://api.github.com/repos/brucewpaul/enzyme/releases{/id}","deployments_url":"https://api.github.com/repos/brucewpaul/enzyme/deployments","created_at":"2017-10-05T21:52:19Z","updated_at":"2017-10-05T21:52:21Z","pushed_at":"2017-11-03T15:00:24Z","git_url":"git://github.com/brucewpaul/enzyme.git","ssh_url":"git@github.com:brucewpaul/enzyme.git","clone_url":"https://github.com/brucewpaul/enzyme.git","svn_url":"https://github.com/brucewpaul/enzyme","homepage":"http://airbnb.io/enzyme/","size":2936,"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,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"airbnb:master","ref":"master","sha":"c66768abecb55fbcc7a5874dc0dcf0581fb72498","user":{"login":"airbnb","id":698437,"avatar_url":"https://avatars3.githubusercontent.com/u/698437?v=4","gravatar_id":"","url":"https://api.github.com/users/airbnb","html_url":"https://github.com/airbnb","followers_url":"https://api.github.com/users/airbnb/followers","following_url":"https://api.github.com/users/airbnb/following{/other_user}","gists_url":"https://api.github.com/users/airbnb/gists{/gist_id}","starred_url":"https://api.github.com/users/airbnb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/airbnb/subscriptions","organizations_url":"https://api.github.com/users/airbnb/orgs","repos_url":"https://api.github.com/users/airbnb/repos","events_url":"https://api.github.com/users/airbnb/events{/privacy}","received_events_url":"https://api.github.com/users/airbnb/received_events","type":"Organization","site_admin":false},"repo":{"id":45942274,"name":"enzyme","full_name":"airbnb/enzyme","owner":{"login":"airbnb","id":698437,"avatar_url":"https://avatars3.githubusercontent.com/u/698437?v=4","gravatar_id":"","url":"https://api.github.com/users/airbnb","html_url":"https://github.com/airbnb","followers_url":"https://api.github.com/users/airbnb/followers","following_url":"https://api.github.com/users/airbnb/following{/other_user}","gists_url":"https://api.github.com/users/airbnb/gists{/gist_id}","starred_url":"https://api.github.com/users/airbnb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/airbnb/subscriptions","organizations_url":"https://api.github.com/users/airbnb/orgs","repos_url":"https://api.github.com/users/airbnb/repos","events_url":"https://api.github.com/users/airbnb/events{/privacy}","received_events_url":"https://api.github.com/users/airbnb/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/airbnb/enzyme","description":"JavaScript Testing utilities for React","fork":false,"url":"https://api.github.com/repos/airbnb/enzyme","forks_url":"https://api.github.com/repos/airbnb/enzyme/forks","keys_url":"https://api.github.com/repos/airbnb/enzyme/keys{/key_id}","collaborators_url":"https://api.github.com/repos/airbnb/enzyme/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/airbnb/enzyme/teams","hooks_url":"https://api.github.com/repos/airbnb/enzyme/hooks","issue_events_url":"https://api.github.com/repos/airbnb/enzyme/issues/events{/number}","events_url":"https://api.github.com/repos/airbnb/enzyme/events","assignees_url":"https://api.github.com/repos/airbnb/enzyme/assignees{/user}","branches_url":"https://api.github.com/repos/airbnb/enzyme/branches{/branch}","tags_url":"https://api.github.com/repos/airbnb/enzyme/tags","blobs_url":"https://api.github.com/repos/airbnb/enzyme/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/airbnb/enzyme/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/airbnb/enzyme/git/refs{/sha}","trees_url":"https://api.github.com/repos/airbnb/enzyme/git/trees{/sha}","statuses_url":"https://api.github.com/repos/airbnb/enzyme/statuses/{sha}","languages_url":"https://api.github.com/repos/airbnb/enzyme/languages","stargazers_url":"https://api.github.com/repos/airbnb/enzyme/stargazers","contributors_url":"https://api.github.com/repos/airbnb/enzyme/contributors","subscribers_url":"https://api.github.com/repos/airbnb/enzyme/subscribers","subscription_url":"https://api.github.com/repos/airbnb/enzyme/subscription","commits_url":"https://api.github.com/repos/airbnb/enzyme/commits{/sha}","git_commits_url":"https://api.github.com/repos/airbnb/enzyme/git/commits{/sha}","comments_url":"https://api.github.com/repos/airbnb/enzyme/comments{/number}","issue_comment_url":"https://api.github.com/repos/airbnb/enzyme/issues/comments{/number}","contents_url":"https://api.github.com/repos/airbnb/enzyme/contents/{+path}","compare_url":"https://api.github.com/repos/airbnb/enzyme/compare/{base}...{head}","merges_url":"https://api.github.com/repos/airbnb/enzyme/merges","archive_url":"https://api.github.com/repos/airbnb/enzyme/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/airbnb/enzyme/downloads","issues_url":"https://api.github.com/repos/airbnb/enzyme/issues{/number}","pulls_url":"https://api.github.com/repos/airbnb/enzyme/pulls{/number}","milestones_url":"https://api.github.com/repos/airbnb/enzyme/milestones{/number}","notifications_url":"https://api.github.com/repos/airbnb/enzyme/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/airbnb/enzyme/labels{/name}","releases_url":"https://api.github.com/repos/airbnb/enzyme/releases{/id}","deployments_url":"https://api.github.com/repos/airbnb/enzyme/deployments","created_at":"2015-11-10T21:45:38Z","updated_at":"2017-11-04T04:40:55Z","pushed_at":"2017-11-04T07:27:29Z","git_url":"git://github.com/airbnb/enzyme.git","ssh_url":"git@github.com:airbnb/enzyme.git","clone_url":"https://github.com/airbnb/enzyme.git","svn_url":"https://github.com/airbnb/enzyme","homepage":"http://airbnb.io/enzyme/","size":3473,"stargazers_count":11362,"watchers_count":11362,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":1131,"mirror_url":null,"archived":false,"open_issues_count":250,"forks":1131,"open_issues":250,"watchers":11362,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/airbnb/enzyme/pulls/1321"},"html":{"href":"https://github.com/airbnb/enzyme/pull/1321"},"issue":{"href":"https://api.github.com/repos/airbnb/enzyme/issues/1321"},"comments":{"href":"https://api.github.com/repos/airbnb/enzyme/issues/1321/comments"},"review_comments":{"href":"https://api.github.com/repos/airbnb/enzyme/pulls/1321/comments"},"review_comment":{"href":"https://api.github.com/repos/airbnb/enzyme/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/airbnb/enzyme/pulls/1321/commits"},"statuses":{"href":"https://api.github.com/repos/airbnb/enzyme/statuses/299d7af9eaf399b0a532b11ffe97b58b0baa20fa"}},"author_association":"NONE"}}
{"actor":{"display_login":"ljharb"}}