{"action":"created","issue":{"url":"https://api.github.com/repos/facebook/jest/issues/2198","repository_url":"https://api.github.com/repos/facebook/jest","labels_url":"https://api.github.com/repos/facebook/jest/issues/2198/labels{/name}","comments_url":"https://api.github.com/repos/facebook/jest/issues/2198/comments","events_url":"https://api.github.com/repos/facebook/jest/issues/2198/events","html_url":"https://github.com/facebook/jest/pull/2198","id":192748394,"number":2198,"title":"Pass `expected` and `actual` objects from matchers and custom errors from jasmine","user":{"login":"ArtemGovorov","id":979966,"avatar_url":"https://avatars.githubusercontent.com/u/979966?v=3","gravatar_id":"","url":"https://api.github.com/users/ArtemGovorov","html_url":"https://github.com/ArtemGovorov","followers_url":"https://api.github.com/users/ArtemGovorov/followers","following_url":"https://api.github.com/users/ArtemGovorov/following{/other_user}","gists_url":"https://api.github.com/users/ArtemGovorov/gists{/gist_id}","starred_url":"https://api.github.com/users/ArtemGovorov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ArtemGovorov/subscriptions","organizations_url":"https://api.github.com/users/ArtemGovorov/orgs","repos_url":"https://api.github.com/users/ArtemGovorov/repos","events_url":"https://api.github.com/users/ArtemGovorov/events{/privacy}","received_events_url":"https://api.github.com/users/ArtemGovorov/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-12-01T03:51:43Z","updated_at":"2016-12-01T03:51:48Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/facebook/jest/pulls/2198","html_url":"https://github.com/facebook/jest/pull/2198","diff_url":"https://github.com/facebook/jest/pull/2198.diff","patch_url":"https://github.com/facebook/jest/pull/2198.patch"},"body":"**Summary**\r\n\r\n`Jasmine`'s built-in [matchers are providing](https://github.com/facebook/jest/blob/master/packages/jest-jasmine2/vendor/jasmine-2.5.2.js#L1568) `matcherName`, plus `expected` and `actual` values, allowing external reporters and integrations to provide any custom diff views, such as\r\n\r\n![diff](https://cloud.githubusercontent.com/assets/979966/20779359/c57881fe-b7bf-11e6-9be1-4211e2f0c0dd.jpg)\r\n\r\nor\r\n\r\n![diffws](https://cloud.githubusercontent.com/assets/979966/20779414/259e65b2-b7c0-11e6-89b0-53058b43e8bd.gif)\r\n\r\nAlso, most of existing standalone assertion libraries, [such as `chai`](https://github.com/chaijs/chai/blob/master/lib/chai/assertion.js#L111), also pass the values in their error object, however [`jasmine` doesn't pass the error object](https://github.com/facebook/jest/blob/master/packages/jest-jasmine2/vendor/jasmine-2.5.2.js#L1611) through.\r\n\r\n`Jest` is providing the built-in diff (which looks great in terminal), however, `Jest`'s matchers are not passing through the matcher results (including `expected` and `actual` values), making it impossible for an external reporter (such as wallaby.js tool) to display another diff view.\r\n\r\nTo address both of the issues:\r\n- no access to the `expected` and `actual` values for `jest` built-in and custom matchers, and generally no access to a matcher result,\r\n- no access to a custom assertion library error, in case if a custom assertion library, such as `chai` or [anything else](https://twitter.com/bruderstein/status/798440122844872704), is used with `jest`,\r\n\r\nI have submitted the PR. Note that I have only extended the `toBe` and `toEqual` matchers, as these are the only two where `expected` vs `actual` diff makes sense."},"comment":{"url":"https://api.github.com/repos/facebook/jest/issues/comments/264071991","html_url":"https://github.com/facebook/jest/pull/2198#issuecomment-264071991","issue_url":"https://api.github.com/repos/facebook/jest/issues/2198","id":264071991,"user":{"login":"facebook-github-bot","id":6422482,"avatar_url":"https://avatars.githubusercontent.com/u/6422482?v=3","gravatar_id":"","url":"https://api.github.com/users/facebook-github-bot","html_url":"https://github.com/facebook-github-bot","followers_url":"https://api.github.com/users/facebook-github-bot/followers","following_url":"https://api.github.com/users/facebook-github-bot/following{/other_user}","gists_url":"https://api.github.com/users/facebook-github-bot/gists{/gist_id}","starred_url":"https://api.github.com/users/facebook-github-bot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/facebook-github-bot/subscriptions","organizations_url":"https://api.github.com/users/facebook-github-bot/orgs","repos_url":"https://api.github.com/users/facebook-github-bot/repos","events_url":"https://api.github.com/users/facebook-github-bot/events{/privacy}","received_events_url":"https://api.github.com/users/facebook-github-bot/received_events","type":"User","site_admin":false},"created_at":"2016-12-01T03:51:48Z","updated_at":"2016-12-01T03:51:48Z","body":"Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla - and if you have received this in error or have any questions, please drop us a line at cla@fb.com. Thanks!\n\n**If you are contributing on behalf of someone else (eg your employer)**: the individual CLA is not sufficient - use https://developers.facebook.com/opensource/cla?type=company instead. Contact cla@fb.com if you have any questions."}}
{"actor":{"display_login":"facebook-github-bot"}}