{"action":"created","issue":{"url":"https://api.github.com/repos/angular/jasminewd/issues/38","labels_url":"https://api.github.com/repos/angular/jasminewd/issues/38/labels{/name}","comments_url":"https://api.github.com/repos/angular/jasminewd/issues/38/comments","events_url":"https://api.github.com/repos/angular/jasminewd/issues/38/events","html_url":"https://github.com/angular/jasminewd/issues/38","id":126368107,"number":38,"title":"Decorating Jasmine's it method","user":{"login":"sebald","id":985701,"avatar_url":"https://avatars.githubusercontent.com/u/985701?v=3","gravatar_id":"","url":"https://api.github.com/users/sebald","html_url":"https://github.com/sebald","followers_url":"https://api.github.com/users/sebald/followers","following_url":"https://api.github.com/users/sebald/following{/other_user}","gists_url":"https://api.github.com/users/sebald/gists{/gist_id}","starred_url":"https://api.github.com/users/sebald/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sebald/subscriptions","organizations_url":"https://api.github.com/users/sebald/orgs","repos_url":"https://api.github.com/users/sebald/repos","events_url":"https://api.github.com/users/sebald/events{/privacy}","received_events_url":"https://api.github.com/users/sebald/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-01-13T08:32:30Z","updated_at":"2016-01-13T17:17:42Z","closed_at":null,"body":"When using `global.<method>` to decorate Jasmine's public API nothing is returned. Usually Jasmine returns the spec object, as you can see in its [source code](https://github.com/jasmine/jasmine/blob/0d4c8d13bb46ef18ecbff250394582e63f7a4696/lib/jasmine-core/jasmine.js#L913-L920).\r\n\r\nUsing `jasmine.getEnv().it('test blabla', () => {})` will correctly return the spec object, but decorating this will mess up Protractor as mentioned by @juliemr in angular/protractor#2823\r\n\r\nI am not quite sure what's the issue here. I checked the source of `jasminewd` and found that `wrapInControlFlow` does not return something, but I thought decorating the `global.it` would add my function *before* `jasminewd` decorates the tests.\r\n\r\n---\r\n\r\nFor context: I want to add additional properties (SRS reference, custom identifier) to the spec object, so that I can create a report with information about SRS coverage etc.\r\n\r\nSomething like this:\r\n\r\n```javascript\r\n// In the test suite\r\nit('SRS_ID_1', 'should test something', () => {\r\n  expect(true).toBeTruthy();\r\n});\r\n```\r\n\r\n```javascript\r\n// Decorator\r\nvar originalIt = global.it;\r\nglobal.it = function (ref, desc, fn) {\r\n  var spec = originalIt(desc, fn);\r\n  spec.result.ref = ref;\r\n  return spec;\r\n}\r\n```\r\n\r\n```javascript\r\n// Reporter\r\n\r\nvar results = [];\r\n\r\njasmine.getEnv().addReporter({\r\n\r\n  specDone: (result) => { results.push(result) },\r\n  jasmineDone () => {\r\n    // Create report\r\n  }\r\n\r\n});\r\n```"},"comment":{"url":"https://api.github.com/repos/angular/jasminewd/issues/comments/171368878","html_url":"https://github.com/angular/jasminewd/issues/38#issuecomment-171368878","issue_url":"https://api.github.com/repos/angular/jasminewd/issues/38","id":171368878,"user":{"login":"juliemr","id":2081709,"avatar_url":"https://avatars.githubusercontent.com/u/2081709?v=3","gravatar_id":"","url":"https://api.github.com/users/juliemr","html_url":"https://github.com/juliemr","followers_url":"https://api.github.com/users/juliemr/followers","following_url":"https://api.github.com/users/juliemr/following{/other_user}","gists_url":"https://api.github.com/users/juliemr/gists{/gist_id}","starred_url":"https://api.github.com/users/juliemr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/juliemr/subscriptions","organizations_url":"https://api.github.com/users/juliemr/orgs","repos_url":"https://api.github.com/users/juliemr/repos","events_url":"https://api.github.com/users/juliemr/events{/privacy}","received_events_url":"https://api.github.com/users/juliemr/received_events","type":"User","site_admin":false},"created_at":"2016-01-13T17:17:42Z","updated_at":"2016-01-13T17:17:42Z","body":"@sebald I think that that commit is actually doing the right thing. Jasminewd should wrap the functions before your code, so it needs to pass along the returned value. Can you make that into a PR?"}}