{"action":"created","issue":{"url":"https://api.github.com/repos/wallabyjs/public/issues/352","labels_url":"https://api.github.com/repos/wallabyjs/public/issues/352/labels{/name}","comments_url":"https://api.github.com/repos/wallabyjs/public/issues/352/comments","events_url":"https://api.github.com/repos/wallabyjs/public/issues/352/events","html_url":"https://github.com/wallabyjs/public/issues/352","id":118868979,"number":352,"title":"Improve reporting for shared expectation code","user":{"login":"IPWright83","id":1374775,"avatar_url":"https://avatars.githubusercontent.com/u/1374775?v=3","gravatar_id":"","url":"https://api.github.com/users/IPWright83","html_url":"https://github.com/IPWright83","followers_url":"https://api.github.com/users/IPWright83/followers","following_url":"https://api.github.com/users/IPWright83/following{/other_user}","gists_url":"https://api.github.com/users/IPWright83/gists{/gist_id}","starred_url":"https://api.github.com/users/IPWright83/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/IPWright83/subscriptions","organizations_url":"https://api.github.com/users/IPWright83/orgs","repos_url":"https://api.github.com/users/IPWright83/repos","events_url":"https://api.github.com/users/IPWright83/events{/privacy}","received_events_url":"https://api.github.com/users/IPWright83/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-11-25T16:07:50Z","updated_at":"2015-11-26T09:10:41Z","closed_at":"2015-11-26T02:30:59Z","body":"I'm using Jasmine to declare all my tests, and in my case I've got lots of duplicate code - so I've moved into a helper function like this:\r\n\r\n````\r\nfunction verifyResult(actual, expected) {\r\n   expect(actual.value).toBe(expected.value);\r\n   expected(actual.myArray).toEqual(expected.myArray);\r\n   ...\r\n}\r\n\r\nit(\"test1\", function() {\r\n   verifyResult({ value: 3, myArray: [ ] }, { value: 3, myArray: [ 1 ] });\r\n});\r\n\r\nit(\"test2\", function() {\r\n   verifyResult({ value: 3, myArray: [ 1 ] }, { value: 4, myArray: [ 1 ] });\r\n});\r\n````\r\n\r\nThe difficultly here is that Wallaby can obviously only show the results for 1 test inline e.g. It'd be nice to improve this somehow (I'm not exactly sure how) - possibly returning all the failed Expectations up slightly in the stack somehow to the actual spec that failed.\r\n"},"comment":{"url":"https://api.github.com/repos/wallabyjs/public/issues/comments/159853940","html_url":"https://github.com/wallabyjs/public/issues/352#issuecomment-159853940","issue_url":"https://api.github.com/repos/wallabyjs/public/issues/352","id":159853940,"user":{"login":"IPWright83","id":1374775,"avatar_url":"https://avatars.githubusercontent.com/u/1374775?v=3","gravatar_id":"","url":"https://api.github.com/users/IPWright83","html_url":"https://github.com/IPWright83","followers_url":"https://api.github.com/users/IPWright83/followers","following_url":"https://api.github.com/users/IPWright83/following{/other_user}","gists_url":"https://api.github.com/users/IPWright83/gists{/gist_id}","starred_url":"https://api.github.com/users/IPWright83/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/IPWright83/subscriptions","organizations_url":"https://api.github.com/users/IPWright83/orgs","repos_url":"https://api.github.com/users/IPWright83/repos","events_url":"https://api.github.com/users/IPWright83/events{/privacy}","received_events_url":"https://api.github.com/users/IPWright83/received_events","type":"User","site_admin":false},"created_at":"2015-11-26T09:10:41Z","updated_at":"2015-11-26T09:10:41Z","body":"Thanks Artem,\r\n\r\nI've not had an issue with Jasmine's reporting, or at least not through the browser (was going to upload an image but Github seems to be having issues with them at the moment).\r\n\r\nI'm definitely going to take a look at that pattern and see how that improves things - it's worth it for the better error reporting.\r\n\r\nThanks"}}