{"action":"opened","issue":{"url":"https://api.github.com/repos/acuminous/yadda/issues/154","labels_url":"https://api.github.com/repos/acuminous/yadda/issues/154/labels{/name}","comments_url":"https://api.github.com/repos/acuminous/yadda/issues/154/comments","events_url":"https://api.github.com/repos/acuminous/yadda/issues/154/events","html_url":"https://github.com/acuminous/yadda/issues/154","id":94777095,"number":154,"title":"@Only annotation breaks when running tests with Jasmine","user":{"login":"samzhao","id":1125203,"avatar_url":"https://avatars.githubusercontent.com/u/1125203?v=3","gravatar_id":"","url":"https://api.github.com/users/samzhao","html_url":"https://github.com/samzhao","followers_url":"https://api.github.com/users/samzhao/followers","following_url":"https://api.github.com/users/samzhao/following{/other_user}","gists_url":"https://api.github.com/users/samzhao/gists{/gist_id}","starred_url":"https://api.github.com/users/samzhao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samzhao/subscriptions","organizations_url":"https://api.github.com/users/samzhao/orgs","repos_url":"https://api.github.com/users/samzhao/repos","events_url":"https://api.github.com/users/samzhao/events{/privacy}","received_events_url":"https://api.github.com/users/samzhao/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-07-13T18:04:21Z","updated_at":"2015-07-13T18:04:21Z","closed_at":null,"body":"Hi,\r\n\r\nIn case anyone else encountered similar problems with Jasmine, I created this issue to post a workaround and hopefully start some discussions on whether or not to integrate this workaround into Yadda's codebase.\r\n\r\nThis is the error I got when I tried to use the `@Only` annotation on my Scenarios:\r\n\r\n```\r\nTypeError: _it is not a function\r\nat it_sync (/Users/<username>/dev/<project-name>/client/tests/test.js:14266:10 <- webpack:///~/yadda/lib/plugins/mocha/BasePlugin.js:61:0)\r\n```\r\n\r\n*Note:* I'm using Webpack and Karma for testing so the `test.js` is the large compiled bundle file, and there's sourcemap set up for webpack to reference the actual file that `test.js` required.\r\n\r\nAfter some digging, I've found the problem is actually [in this line](https://github.com/acuminous/yadda/blob/0b5e28b932eb9e054de501c2ce37e99db3be88dd/lib/plugins/mocha/BasePlugin.js#L68) where\r\n\r\n```\r\nif (has_annotation(annotations, 'only')) return container.it.only;\r\n```\r\n\r\nthe `it.only` is `undefined`.\r\n\r\nI don't think Jasmine has an `it.only` method, or maybe it does and just references `iit` internally, but that's what caused the problem.\r\n\r\n**Here's my workaround:**\r\n\r\n```javascript\r\nif (jasmine.version) { // for v2.x\r\n    // Jasmine 2.x abandoned iit/ddescribe in favor of fit/fdescribe ('f' as in focused)\r\n    global.it.only = fit\r\n    global.describe.only = fdescribe\r\n}\r\nelse { // for v1.x\r\n    global.it.only = iit\r\n    global.describe.only = ddescribe\r\n}\r\n```\r\n\r\nI don't know Yadda's codebase well enough to suggest a fix in Yadda itself, but I hope this helps someone who got stuck with this error."}}