{"action":"created","comment":{"url":"https://api.github.com/repos/avajs/ava/pulls/comments/167895289","pull_request_review_id":96176239,"id":167895289,"diff_hunk":"@@ -910,13 +910,20 @@ Assert that `value` is deeply equal to `expected`. See [Concordance](https://git\n \n Assert that `value` is not deeply equal to `expected`. The inverse of `.deepEqual()`.\n \n-### `.throws(function|promise, [error, [message]])`\n+### `.throws(thrower, [expected, [message]])`\n \n-Assert that `function` throws an error, `promise` rejects with an error, or `function` returns a rejected `promise`.\n+Assert that an error is thrown. `thrower` can be a function which should throw, or return a promise that should reject, or an observable that should error. Alternatively a promise or observable can be passed directly.\n \n-`error` can be an error constructor, error message, regex matched against the error message, or validation function.\n+The thrown value *must* be an error. It is returned so you can run more assertions against it.\n \n-Returns the error thrown by `function` or a promise for the rejection reason of the specified `promise`.\n+`expected` can be a constructor, in which case the thrown error must be an instance. It can be a string, which is compared against the thrown error's message, or a regular expression which is matched against this message. You can also specify a matcher object with one or more of the following properties:\n+\n+* `is`: the thrown error must be strictly equal to `expected.is`\n+* `message`: either a string, which is compared against the thrown error's message, or a regular expression, which is matched against this message\n+* `name`: the expected `.name` value of the thrown error\n+* `of`: a constructor, the thrown error must be an instance of\n+\n+`expected` does not need to be specified. If you don't need it but do want to set an assertion message you have to specify `null` or the empty object `{}`.","path":"readme.md","position":21,"original_position":21,"commit_id":"d467e720c4ba373d49fbcc1bf68bc0bd704bd539","original_commit_id":"d467e720c4ba373d49fbcc1bf68bc0bd704bd539","user":{"login":"sindresorhus","id":170270,"avatar_url":"https://avatars1.githubusercontent.com/u/170270?v=4","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":"Since we're being strict, can we only support `null`? Doesn't make sense to specify an empty object.","created_at":"2018-02-13T15:16:05Z","updated_at":"2018-02-13T15:21:10Z","html_url":"https://github.com/avajs/ava/pull/1704#discussion_r167895289","pull_request_url":"https://api.github.com/repos/avajs/ava/pulls/1704","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/avajs/ava/pulls/comments/167895289"},"html":{"href":"https://github.com/avajs/ava/pull/1704#discussion_r167895289"},"pull_request":{"href":"https://api.github.com/repos/avajs/ava/pulls/1704"}}},"pull_request":{"url":"https://api.github.com/repos/avajs/ava/pulls/1704","id":168644832,"html_url":"https://github.com/avajs/ava/pull/1704","diff_url":"https://github.com/avajs/ava/pull/1704.diff","patch_url":"https://github.com/avajs/ava/pull/1704.patch","issue_url":"https://api.github.com/repos/avajs/ava/issues/1704","number":1704,"state":"open","locked":false,"title":"Reimplement t.throws() and t.notThrows()","user":{"login":"novemberborn","id":33538,"avatar_url":"https://avatars0.githubusercontent.com/u/33538?v=4","gravatar_id":"","url":"https://api.github.com/users/novemberborn","html_url":"https://github.com/novemberborn","followers_url":"https://api.github.com/users/novemberborn/followers","following_url":"https://api.github.com/users/novemberborn/following{/other_user}","gists_url":"https://api.github.com/users/novemberborn/gists{/gist_id}","starred_url":"https://api.github.com/users/novemberborn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/novemberborn/subscriptions","organizations_url":"https://api.github.com/users/novemberborn/orgs","repos_url":"https://api.github.com/users/novemberborn/repos","events_url":"https://api.github.com/users/novemberborn/events{/privacy}","received_events_url":"https://api.github.com/users/novemberborn/received_events","type":"User","site_admin":false},"body":"Implement `t.throws()` and `t.notThrows()` ourselves.\r\n\r\nRemove `core-assert` dependency. When passed a function as the second argument, `t.throws()` now assumes it's a constructor. This removes support for a validation function, which may or may not have worked. Refs #1047.\r\n\r\n`t.throws()` now fails if the exception is not an error. Fixes #1440.\r\n\r\nRegular expressions are now matched against the error message, not the result of casting the error to a string. Fixes #1445.\r\n\r\nValidate second argument to `t.throws()`. Refs #1676.\r\n\r\nAssertion failures now display how AVA arrived at the exception. Constructors are printed when the error is not a correct instance. Fixes #1471.\r\n\r\nStill need to support an expectation object. I'm planning to implement this alongside the current support for passing constructors, strings or regular expressions. The shorthand form seems useful and this way we won't have too many backward compatibility issues.\r\n\r\nI'll be looking to support (a combination of) the following use cases:\r\n\r\n```js\r\nt.throws(fn, {of: SyntaxError}) // err instanceof SyntaxError\r\nt.throws(fn, {name: 'SyntaxError'}) // err.name === 'SyntaxError'\r\nt.throws(fn, {is: expectedErrorInstance}) // err === expectedErrorInstance\r\nt.throws(fn, {message: 'expected error message'}) // err.message === 'expected error message'\r\nt.throws(fn, {message: /expected error message/}) // /expected error message/.test(err.message)\r\n```\r\n\r\nI'll try to post some screenshots too.","created_at":"2018-02-12T17:44:49Z","updated_at":"2018-02-13T15:21:10Z","closed_at":null,"merged_at":null,"merge_commit_sha":"88b36c999c6f46733d02e3a199159b948c40e472","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/avajs/ava/pulls/1704/commits","review_comments_url":"https://api.github.com/repos/avajs/ava/pulls/1704/comments","review_comment_url":"https://api.github.com/repos/avajs/ava/pulls/comments{/number}","comments_url":"https://api.github.com/repos/avajs/ava/issues/1704/comments","statuses_url":"https://api.github.com/repos/avajs/ava/statuses/d467e720c4ba373d49fbcc1bf68bc0bd704bd539","head":{"label":"avajs:new-throws","ref":"new-throws","sha":"d467e720c4ba373d49fbcc1bf68bc0bd704bd539","user":{"login":"avajs","id":8527916,"avatar_url":"https://avatars3.githubusercontent.com/u/8527916?v=4","gravatar_id":"","url":"https://api.github.com/users/avajs","html_url":"https://github.com/avajs","followers_url":"https://api.github.com/users/avajs/followers","following_url":"https://api.github.com/users/avajs/following{/other_user}","gists_url":"https://api.github.com/users/avajs/gists{/gist_id}","starred_url":"https://api.github.com/users/avajs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/avajs/subscriptions","organizations_url":"https://api.github.com/users/avajs/orgs","repos_url":"https://api.github.com/users/avajs/repos","events_url":"https://api.github.com/users/avajs/events{/privacy}","received_events_url":"https://api.github.com/users/avajs/received_events","type":"Organization","site_admin":false},"repo":{"id":26820798,"name":"ava","full_name":"avajs/ava","owner":{"login":"avajs","id":8527916,"avatar_url":"https://avatars3.githubusercontent.com/u/8527916?v=4","gravatar_id":"","url":"https://api.github.com/users/avajs","html_url":"https://github.com/avajs","followers_url":"https://api.github.com/users/avajs/followers","following_url":"https://api.github.com/users/avajs/following{/other_user}","gists_url":"https://api.github.com/users/avajs/gists{/gist_id}","starred_url":"https://api.github.com/users/avajs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/avajs/subscriptions","organizations_url":"https://api.github.com/users/avajs/orgs","repos_url":"https://api.github.com/users/avajs/repos","events_url":"https://api.github.com/users/avajs/events{/privacy}","received_events_url":"https://api.github.com/users/avajs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/avajs/ava","description":":rocket: Futuristic JavaScript test runner","fork":false,"url":"https://api.github.com/repos/avajs/ava","forks_url":"https://api.github.com/repos/avajs/ava/forks","keys_url":"https://api.github.com/repos/avajs/ava/keys{/key_id}","collaborators_url":"https://api.github.com/repos/avajs/ava/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/avajs/ava/teams","hooks_url":"https://api.github.com/repos/avajs/ava/hooks","issue_events_url":"https://api.github.com/repos/avajs/ava/issues/events{/number}","events_url":"https://api.github.com/repos/avajs/ava/events","assignees_url":"https://api.github.com/repos/avajs/ava/assignees{/user}","branches_url":"https://api.github.com/repos/avajs/ava/branches{/branch}","tags_url":"https://api.github.com/repos/avajs/ava/tags","blobs_url":"https://api.github.com/repos/avajs/ava/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/avajs/ava/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/avajs/ava/git/refs{/sha}","trees_url":"https://api.github.com/repos/avajs/ava/git/trees{/sha}","statuses_url":"https://api.github.com/repos/avajs/ava/statuses/{sha}","languages_url":"https://api.github.com/repos/avajs/ava/languages","stargazers_url":"https://api.github.com/repos/avajs/ava/stargazers","contributors_url":"https://api.github.com/repos/avajs/ava/contributors","subscribers_url":"https://api.github.com/repos/avajs/ava/subscribers","subscription_url":"https://api.github.com/repos/avajs/ava/subscription","commits_url":"https://api.github.com/repos/avajs/ava/commits{/sha}","git_commits_url":"https://api.github.com/repos/avajs/ava/git/commits{/sha}","comments_url":"https://api.github.com/repos/avajs/ava/comments{/number}","issue_comment_url":"https://api.github.com/repos/avajs/ava/issues/comments{/number}","contents_url":"https://api.github.com/repos/avajs/ava/contents/{+path}","compare_url":"https://api.github.com/repos/avajs/ava/compare/{base}...{head}","merges_url":"https://api.github.com/repos/avajs/ava/merges","archive_url":"https://api.github.com/repos/avajs/ava/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/avajs/ava/downloads","issues_url":"https://api.github.com/repos/avajs/ava/issues{/number}","pulls_url":"https://api.github.com/repos/avajs/ava/pulls{/number}","milestones_url":"https://api.github.com/repos/avajs/ava/milestones{/number}","notifications_url":"https://api.github.com/repos/avajs/ava/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/avajs/ava/labels{/name}","releases_url":"https://api.github.com/repos/avajs/ava/releases{/id}","deployments_url":"https://api.github.com/repos/avajs/ava/deployments","created_at":"2014-11-18T17:20:26Z","updated_at":"2018-02-13T15:14:03Z","pushed_at":"2018-02-13T14:30:18Z","git_url":"git://github.com/avajs/ava.git","ssh_url":"git@github.com:avajs/ava.git","clone_url":"https://github.com/avajs/ava.git","svn_url":"https://github.com/avajs/ava","homepage":"","size":6556,"stargazers_count":12943,"watchers_count":12943,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":745,"mirror_url":null,"archived":false,"open_issues_count":130,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":745,"open_issues":130,"watchers":12943,"default_branch":"master"}},"base":{"label":"avajs:master","ref":"master","sha":"0948d87a79ac6f91afa5766a45dee212e511b6f9","user":{"login":"avajs","id":8527916,"avatar_url":"https://avatars3.githubusercontent.com/u/8527916?v=4","gravatar_id":"","url":"https://api.github.com/users/avajs","html_url":"https://github.com/avajs","followers_url":"https://api.github.com/users/avajs/followers","following_url":"https://api.github.com/users/avajs/following{/other_user}","gists_url":"https://api.github.com/users/avajs/gists{/gist_id}","starred_url":"https://api.github.com/users/avajs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/avajs/subscriptions","organizations_url":"https://api.github.com/users/avajs/orgs","repos_url":"https://api.github.com/users/avajs/repos","events_url":"https://api.github.com/users/avajs/events{/privacy}","received_events_url":"https://api.github.com/users/avajs/received_events","type":"Organization","site_admin":false},"repo":{"id":26820798,"name":"ava","full_name":"avajs/ava","owner":{"login":"avajs","id":8527916,"avatar_url":"https://avatars3.githubusercontent.com/u/8527916?v=4","gravatar_id":"","url":"https://api.github.com/users/avajs","html_url":"https://github.com/avajs","followers_url":"https://api.github.com/users/avajs/followers","following_url":"https://api.github.com/users/avajs/following{/other_user}","gists_url":"https://api.github.com/users/avajs/gists{/gist_id}","starred_url":"https://api.github.com/users/avajs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/avajs/subscriptions","organizations_url":"https://api.github.com/users/avajs/orgs","repos_url":"https://api.github.com/users/avajs/repos","events_url":"https://api.github.com/users/avajs/events{/privacy}","received_events_url":"https://api.github.com/users/avajs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/avajs/ava","description":":rocket: Futuristic JavaScript test runner","fork":false,"url":"https://api.github.com/repos/avajs/ava","forks_url":"https://api.github.com/repos/avajs/ava/forks","keys_url":"https://api.github.com/repos/avajs/ava/keys{/key_id}","collaborators_url":"https://api.github.com/repos/avajs/ava/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/avajs/ava/teams","hooks_url":"https://api.github.com/repos/avajs/ava/hooks","issue_events_url":"https://api.github.com/repos/avajs/ava/issues/events{/number}","events_url":"https://api.github.com/repos/avajs/ava/events","assignees_url":"https://api.github.com/repos/avajs/ava/assignees{/user}","branches_url":"https://api.github.com/repos/avajs/ava/branches{/branch}","tags_url":"https://api.github.com/repos/avajs/ava/tags","blobs_url":"https://api.github.com/repos/avajs/ava/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/avajs/ava/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/avajs/ava/git/refs{/sha}","trees_url":"https://api.github.com/repos/avajs/ava/git/trees{/sha}","statuses_url":"https://api.github.com/repos/avajs/ava/statuses/{sha}","languages_url":"https://api.github.com/repos/avajs/ava/languages","stargazers_url":"https://api.github.com/repos/avajs/ava/stargazers","contributors_url":"https://api.github.com/repos/avajs/ava/contributors","subscribers_url":"https://api.github.com/repos/avajs/ava/subscribers","subscription_url":"https://api.github.com/repos/avajs/ava/subscription","commits_url":"https://api.github.com/repos/avajs/ava/commits{/sha}","git_commits_url":"https://api.github.com/repos/avajs/ava/git/commits{/sha}","comments_url":"https://api.github.com/repos/avajs/ava/comments{/number}","issue_comment_url":"https://api.github.com/repos/avajs/ava/issues/comments{/number}","contents_url":"https://api.github.com/repos/avajs/ava/contents/{+path}","compare_url":"https://api.github.com/repos/avajs/ava/compare/{base}...{head}","merges_url":"https://api.github.com/repos/avajs/ava/merges","archive_url":"https://api.github.com/repos/avajs/ava/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/avajs/ava/downloads","issues_url":"https://api.github.com/repos/avajs/ava/issues{/number}","pulls_url":"https://api.github.com/repos/avajs/ava/pulls{/number}","milestones_url":"https://api.github.com/repos/avajs/ava/milestones{/number}","notifications_url":"https://api.github.com/repos/avajs/ava/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/avajs/ava/labels{/name}","releases_url":"https://api.github.com/repos/avajs/ava/releases{/id}","deployments_url":"https://api.github.com/repos/avajs/ava/deployments","created_at":"2014-11-18T17:20:26Z","updated_at":"2018-02-13T15:14:03Z","pushed_at":"2018-02-13T14:30:18Z","git_url":"git://github.com/avajs/ava.git","ssh_url":"git@github.com:avajs/ava.git","clone_url":"https://github.com/avajs/ava.git","svn_url":"https://github.com/avajs/ava","homepage":"","size":6556,"stargazers_count":12943,"watchers_count":12943,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":745,"mirror_url":null,"archived":false,"open_issues_count":130,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":745,"open_issues":130,"watchers":12943,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/avajs/ava/pulls/1704"},"html":{"href":"https://github.com/avajs/ava/pull/1704"},"issue":{"href":"https://api.github.com/repos/avajs/ava/issues/1704"},"comments":{"href":"https://api.github.com/repos/avajs/ava/issues/1704/comments"},"review_comments":{"href":"https://api.github.com/repos/avajs/ava/pulls/1704/comments"},"review_comment":{"href":"https://api.github.com/repos/avajs/ava/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/avajs/ava/pulls/1704/commits"},"statuses":{"href":"https://api.github.com/repos/avajs/ava/statuses/d467e720c4ba373d49fbcc1bf68bc0bd704bd539"}},"author_association":"OWNER"}}
{"actor":{"display_login":"sindresorhus"}}