{"action":"created","comment":{"url":"https://api.github.com/repos/sindresorhus/ava/pulls/comments/39528531","id":39528531,"diff_hunk":"@@ -35,29 +32,64 @@ var cli = meow({\n \tstring: ['_']\n });\n \n+var errors = [];\n+var failed = 0;\n+var passed = 0;\n+\n function error(err) {\n \tconsole.error(err.stack);\n \tprocess.exit(1);\n }\n \n+function test(data) {\n+\tvar isError = data.err.message;\n+\n+\tif (isError) {\n+\t\tlog.error(data.title, chalk.red(data.err.message));\n+\n+\t\terrors.push(data);\n+\t\tfailed++;\n+\t} else {\n+\t\tlog.test(null, data.title, data.duration);\n+\n+\t\tpassed++;\n+\t}\n+}\n+\n function run(file) {\n-\tfs.stat(file, function (err, stats) {\n-\t\tif (err) {\n-\t\t\tconsole.error(err.message);\n-\t\t\tprocess.exit(1);\n-\t\t}\n-\n-\t\tif (stats.isDirectory()) {\n-\t\t\tinit(path.join(file, '*.js'));\n-\t\t\treturn;\n-\t\t}\n-\n-\t\tif (path.extname(file) !== '.js') {\n-\t\t\treturn;\n-\t\t}\n-\n-\t\trequire(file);\n+\tvar stats = fs.statSync(file);\n+\n+\tif (stats.isDirectory()) {\n+\t\treturn init(path.join(file, '*.js'));\n+\t}\n+\n+\tif (path.extname(file) !== '.js') {\n+\t\treturn Promise.resolve();\n+\t}\n+\n+\treturn fork(file).on('message', test);","path":"cli.js","position":74,"original_position":74,"commit_id":"7dccf70f9b8960c746fea831d8cf442debe19529","original_commit_id":"7dccf70f9b8960c746fea831d8cf442debe19529","user":{"login":"sindresorhus","id":170270,"avatar_url":"https://avatars.githubusercontent.com/u/170270?v=3","gravatar_id":"","url":"https://api.github.com/users/sindresorhus","html_url":"https://github.com/sindresorhus","followers_url":"https://api.github.com/users/sindresorhus/followers","following_url":"https://api.github.com/users/sindresorhus/following{/other_user}","gists_url":"https://api.github.com/users/sindresorhus/gists{/gist_id}","starred_url":"https://api.github.com/users/sindresorhus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sindresorhus/subscriptions","organizations_url":"https://api.github.com/users/sindresorhus/orgs","repos_url":"https://api.github.com/users/sindresorhus/repos","events_url":"https://api.github.com/users/sindresorhus/events{/privacy}","received_events_url":"https://api.github.com/users/sindresorhus/received_events","type":"User","site_admin":false},"body":"Instead of a `message` event, the result should be as the resolved promise.","created_at":"2015-09-15T15:57:34Z","updated_at":"2015-09-15T15:57:34Z","html_url":"https://github.com/sindresorhus/ava/pull/47#discussion_r39528531","pull_request_url":"https://api.github.com/repos/sindresorhus/ava/pulls/47","_links":{"self":{"href":"https://api.github.com/repos/sindresorhus/ava/pulls/comments/39528531"},"html":{"href":"https://github.com/sindresorhus/ava/pull/47#discussion_r39528531"},"pull_request":{"href":"https://api.github.com/repos/sindresorhus/ava/pulls/47"}}},"pull_request":{"url":"https://api.github.com/repos/sindresorhus/ava/pulls/47","id":44674511,"html_url":"https://github.com/sindresorhus/ava/pull/47","diff_url":"https://github.com/sindresorhus/ava/pull/47.diff","patch_url":"https://github.com/sindresorhus/ava/pull/47.patch","issue_url":"https://api.github.com/repos/sindresorhus/ava/issues/47","number":47,"state":"open","locked":false,"title":"Parallelism","user":{"login":"vdemedes","id":697676,"avatar_url":"https://avatars.githubusercontent.com/u/697676?v=3","gravatar_id":"","url":"https://api.github.com/users/vdemedes","html_url":"https://github.com/vdemedes","followers_url":"https://api.github.com/users/vdemedes/followers","following_url":"https://api.github.com/users/vdemedes/following{/other_user}","gists_url":"https://api.github.com/users/vdemedes/gists{/gist_id}","starred_url":"https://api.github.com/users/vdemedes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vdemedes/subscriptions","organizations_url":"https://api.github.com/users/vdemedes/orgs","repos_url":"https://api.github.com/users/vdemedes/repos","events_url":"https://api.github.com/users/vdemedes/events{/privacy}","received_events_url":"https://api.github.com/users/vdemedes/received_events","type":"User","site_admin":false},"body":"This PR is related to #1.\r\n\r\n### Description\r\n\r\nTest files supplied to `ava` are now run in their own `node` process. This is implemented using [child_process#fork](https://nodejs.org/api/child_process.html#child_process_child_process_fork_modulepath_args_options).\r\n\r\n\r\n### Changes\r\n\r\n- [x] Separate output functions to `lib/logger.js`\r\n- [x] Fork for each test file using `child_process#fork`\r\n- [x] Create an intermediary [babel.js](https://github.com/sindresorhus/ava/pull/47/files#diff-f6ab9a89a7b25074280e693908d6cb01R1) script, which registers a require hook (`babel/register`) for ES6 support\r\n- [x] Exit `ava` CLI with a correct exit code\r\n\r\n\r\n### Output\r\n\r\nOutput remains the same as before, you'll see no visual differences. Although, I do think that we should prefix/suffix test titles with a test file in case of failure, to know where this test actually is. For example:\r\n\r\nCommand:\r\n\r\n```\r\n$ ava\r\n```\r\n\r\n`test` directory contents:\r\n\r\n```\r\n- test-requests.js\r\n- test-options.js\r\n```\r\n\r\n```\r\n  ✔ send a request\r\n  ✖ parse options - error title (test-options.js)\r\n```\r\n\r\nOther than that, let's discuss this! I think this is a killer feature for AVA.","created_at":"2015-09-10T14:28:49Z","updated_at":"2015-09-15T15:57:34Z","closed_at":null,"merged_at":null,"merge_commit_sha":"fdb89dbe29c480d09a8820c271b2f15ee11a76a9","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/sindresorhus/ava/pulls/47/commits","review_comments_url":"https://api.github.com/repos/sindresorhus/ava/pulls/47/comments","review_comment_url":"https://api.github.com/repos/sindresorhus/ava/pulls/comments{/number}","comments_url":"https://api.github.com/repos/sindresorhus/ava/issues/47/comments","statuses_url":"https://api.github.com/repos/sindresorhus/ava/statuses/7dccf70f9b8960c746fea831d8cf442debe19529","head":{"label":"vdemedes:parallelism","ref":"parallelism","sha":"7dccf70f9b8960c746fea831d8cf442debe19529","user":{"login":"vdemedes","id":697676,"avatar_url":"https://avatars.githubusercontent.com/u/697676?v=3","gravatar_id":"","url":"https://api.github.com/users/vdemedes","html_url":"https://github.com/vdemedes","followers_url":"https://api.github.com/users/vdemedes/followers","following_url":"https://api.github.com/users/vdemedes/following{/other_user}","gists_url":"https://api.github.com/users/vdemedes/gists{/gist_id}","starred_url":"https://api.github.com/users/vdemedes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vdemedes/subscriptions","organizations_url":"https://api.github.com/users/vdemedes/orgs","repos_url":"https://api.github.com/users/vdemedes/repos","events_url":"https://api.github.com/users/vdemedes/events{/privacy}","received_events_url":"https://api.github.com/users/vdemedes/received_events","type":"User","site_admin":false},"repo":{"id":41728524,"name":"ava","full_name":"vdemedes/ava","owner":{"login":"vdemedes","id":697676,"avatar_url":"https://avatars.githubusercontent.com/u/697676?v=3","gravatar_id":"","url":"https://api.github.com/users/vdemedes","html_url":"https://github.com/vdemedes","followers_url":"https://api.github.com/users/vdemedes/followers","following_url":"https://api.github.com/users/vdemedes/following{/other_user}","gists_url":"https://api.github.com/users/vdemedes/gists{/gist_id}","starred_url":"https://api.github.com/users/vdemedes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vdemedes/subscriptions","organizations_url":"https://api.github.com/users/vdemedes/orgs","repos_url":"https://api.github.com/users/vdemedes/repos","events_url":"https://api.github.com/users/vdemedes/events{/privacy}","received_events_url":"https://api.github.com/users/vdemedes/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/vdemedes/ava","description":"Simple concurrent test runner","fork":true,"url":"https://api.github.com/repos/vdemedes/ava","forks_url":"https://api.github.com/repos/vdemedes/ava/forks","keys_url":"https://api.github.com/repos/vdemedes/ava/keys{/key_id}","collaborators_url":"https://api.github.com/repos/vdemedes/ava/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/vdemedes/ava/teams","hooks_url":"https://api.github.com/repos/vdemedes/ava/hooks","issue_events_url":"https://api.github.com/repos/vdemedes/ava/issues/events{/number}","events_url":"https://api.github.com/repos/vdemedes/ava/events","assignees_url":"https://api.github.com/repos/vdemedes/ava/assignees{/user}","branches_url":"https://api.github.com/repos/vdemedes/ava/branches{/branch}","tags_url":"https://api.github.com/repos/vdemedes/ava/tags","blobs_url":"https://api.github.com/repos/vdemedes/ava/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/vdemedes/ava/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/vdemedes/ava/git/refs{/sha}","trees_url":"https://api.github.com/repos/vdemedes/ava/git/trees{/sha}","statuses_url":"https://api.github.com/repos/vdemedes/ava/statuses/{sha}","languages_url":"https://api.github.com/repos/vdemedes/ava/languages","stargazers_url":"https://api.github.com/repos/vdemedes/ava/stargazers","contributors_url":"https://api.github.com/repos/vdemedes/ava/contributors","subscribers_url":"https://api.github.com/repos/vdemedes/ava/subscribers","subscription_url":"https://api.github.com/repos/vdemedes/ava/subscription","commits_url":"https://api.github.com/repos/vdemedes/ava/commits{/sha}","git_commits_url":"https://api.github.com/repos/vdemedes/ava/git/commits{/sha}","comments_url":"https://api.github.com/repos/vdemedes/ava/comments{/number}","issue_comment_url":"https://api.github.com/repos/vdemedes/ava/issues/comments{/number}","contents_url":"https://api.github.com/repos/vdemedes/ava/contents/{+path}","compare_url":"https://api.github.com/repos/vdemedes/ava/compare/{base}...{head}","merges_url":"https://api.github.com/repos/vdemedes/ava/merges","archive_url":"https://api.github.com/repos/vdemedes/ava/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/vdemedes/ava/downloads","issues_url":"https://api.github.com/repos/vdemedes/ava/issues{/number}","pulls_url":"https://api.github.com/repos/vdemedes/ava/pulls{/number}","milestones_url":"https://api.github.com/repos/vdemedes/ava/milestones{/number}","notifications_url":"https://api.github.com/repos/vdemedes/ava/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/vdemedes/ava/labels{/name}","releases_url":"https://api.github.com/repos/vdemedes/ava/releases{/id}","created_at":"2015-09-01T09:08:19Z","updated_at":"2015-09-01T09:08:20Z","pushed_at":"2015-09-15T15:03:49Z","git_url":"git://github.com/vdemedes/ava.git","ssh_url":"git@github.com:vdemedes/ava.git","clone_url":"https://github.com/vdemedes/ava.git","svn_url":"https://github.com/vdemedes/ava","homepage":"","size":2848,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"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":"sindresorhus:master","ref":"master","sha":"5309d6945b1d661556a663856d32c98688b71927","user":{"login":"sindresorhus","id":170270,"avatar_url":"https://avatars.githubusercontent.com/u/170270?v=3","gravatar_id":"","url":"https://api.github.com/users/sindresorhus","html_url":"https://github.com/sindresorhus","followers_url":"https://api.github.com/users/sindresorhus/followers","following_url":"https://api.github.com/users/sindresorhus/following{/other_user}","gists_url":"https://api.github.com/users/sindresorhus/gists{/gist_id}","starred_url":"https://api.github.com/users/sindresorhus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sindresorhus/subscriptions","organizations_url":"https://api.github.com/users/sindresorhus/orgs","repos_url":"https://api.github.com/users/sindresorhus/repos","events_url":"https://api.github.com/users/sindresorhus/events{/privacy}","received_events_url":"https://api.github.com/users/sindresorhus/received_events","type":"User","site_admin":false},"repo":{"id":26820798,"name":"ava","full_name":"sindresorhus/ava","owner":{"login":"sindresorhus","id":170270,"avatar_url":"https://avatars.githubusercontent.com/u/170270?v=3","gravatar_id":"","url":"https://api.github.com/users/sindresorhus","html_url":"https://github.com/sindresorhus","followers_url":"https://api.github.com/users/sindresorhus/followers","following_url":"https://api.github.com/users/sindresorhus/following{/other_user}","gists_url":"https://api.github.com/users/sindresorhus/gists{/gist_id}","starred_url":"https://api.github.com/users/sindresorhus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sindresorhus/subscriptions","organizations_url":"https://api.github.com/users/sindresorhus/orgs","repos_url":"https://api.github.com/users/sindresorhus/repos","events_url":"https://api.github.com/users/sindresorhus/events{/privacy}","received_events_url":"https://api.github.com/users/sindresorhus/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/sindresorhus/ava","description":"Simple concurrent test runner","fork":false,"url":"https://api.github.com/repos/sindresorhus/ava","forks_url":"https://api.github.com/repos/sindresorhus/ava/forks","keys_url":"https://api.github.com/repos/sindresorhus/ava/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sindresorhus/ava/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sindresorhus/ava/teams","hooks_url":"https://api.github.com/repos/sindresorhus/ava/hooks","issue_events_url":"https://api.github.com/repos/sindresorhus/ava/issues/events{/number}","events_url":"https://api.github.com/repos/sindresorhus/ava/events","assignees_url":"https://api.github.com/repos/sindresorhus/ava/assignees{/user}","branches_url":"https://api.github.com/repos/sindresorhus/ava/branches{/branch}","tags_url":"https://api.github.com/repos/sindresorhus/ava/tags","blobs_url":"https://api.github.com/repos/sindresorhus/ava/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sindresorhus/ava/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sindresorhus/ava/git/refs{/sha}","trees_url":"https://api.github.com/repos/sindresorhus/ava/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sindresorhus/ava/statuses/{sha}","languages_url":"https://api.github.com/repos/sindresorhus/ava/languages","stargazers_url":"https://api.github.com/repos/sindresorhus/ava/stargazers","contributors_url":"https://api.github.com/repos/sindresorhus/ava/contributors","subscribers_url":"https://api.github.com/repos/sindresorhus/ava/subscribers","subscription_url":"https://api.github.com/repos/sindresorhus/ava/subscription","commits_url":"https://api.github.com/repos/sindresorhus/ava/commits{/sha}","git_commits_url":"https://api.github.com/repos/sindresorhus/ava/git/commits{/sha}","comments_url":"https://api.github.com/repos/sindresorhus/ava/comments{/number}","issue_comment_url":"https://api.github.com/repos/sindresorhus/ava/issues/comments{/number}","contents_url":"https://api.github.com/repos/sindresorhus/ava/contents/{+path}","compare_url":"https://api.github.com/repos/sindresorhus/ava/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sindresorhus/ava/merges","archive_url":"https://api.github.com/repos/sindresorhus/ava/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sindresorhus/ava/downloads","issues_url":"https://api.github.com/repos/sindresorhus/ava/issues{/number}","pulls_url":"https://api.github.com/repos/sindresorhus/ava/pulls{/number}","milestones_url":"https://api.github.com/repos/sindresorhus/ava/milestones{/number}","notifications_url":"https://api.github.com/repos/sindresorhus/ava/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sindresorhus/ava/labels{/name}","releases_url":"https://api.github.com/repos/sindresorhus/ava/releases{/id}","created_at":"2014-11-18T17:20:26Z","updated_at":"2015-09-14T06:25:58Z","pushed_at":"2015-09-15T15:03:49Z","git_url":"git://github.com/sindresorhus/ava.git","ssh_url":"git@github.com:sindresorhus/ava.git","clone_url":"https://github.com/sindresorhus/ava.git","svn_url":"https://github.com/sindresorhus/ava","homepage":"","size":3270,"stargazers_count":387,"watchers_count":387,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":11,"mirror_url":null,"open_issues_count":22,"forks":11,"open_issues":22,"watchers":387,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/sindresorhus/ava/pulls/47"},"html":{"href":"https://github.com/sindresorhus/ava/pull/47"},"issue":{"href":"https://api.github.com/repos/sindresorhus/ava/issues/47"},"comments":{"href":"https://api.github.com/repos/sindresorhus/ava/issues/47/comments"},"review_comments":{"href":"https://api.github.com/repos/sindresorhus/ava/pulls/47/comments"},"review_comment":{"href":"https://api.github.com/repos/sindresorhus/ava/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/sindresorhus/ava/pulls/47/commits"},"statuses":{"href":"https://api.github.com/repos/sindresorhus/ava/statuses/7dccf70f9b8960c746fea831d8cf442debe19529"}}}}