{"action":"opened","issue":{"url":"https://api.github.com/repos/AtomBuild/atom-build-gulp/issues/5","labels_url":"https://api.github.com/repos/AtomBuild/atom-build-gulp/issues/5/labels{/name}","comments_url":"https://api.github.com/repos/AtomBuild/atom-build-gulp/issues/5/comments","events_url":"https://api.github.com/repos/AtomBuild/atom-build-gulp/issues/5/events","html_url":"https://github.com/AtomBuild/atom-build-gulp/issues/5","id":123063534,"number":5,"title":"Gulp file cannot be parsed when `mocha` is used (and a temporary workaround) ","user":{"login":"akfish","id":922715,"avatar_url":"https://avatars.githubusercontent.com/u/922715?v=3","gravatar_id":"","url":"https://api.github.com/users/akfish","html_url":"https://github.com/akfish","followers_url":"https://api.github.com/users/akfish/followers","following_url":"https://api.github.com/users/akfish/following{/other_user}","gists_url":"https://api.github.com/users/akfish/gists{/gist_id}","starred_url":"https://api.github.com/users/akfish/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akfish/subscriptions","organizations_url":"https://api.github.com/users/akfish/orgs","repos_url":"https://api.github.com/users/akfish/repos","events_url":"https://api.github.com/users/akfish/events{/privacy}","received_events_url":"https://api.github.com/users/akfish/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-12-19T05:26:42Z","updated_at":"2015-12-19T05:26:42Z","closed_at":null,"body":"This is a wired bug. Whenever `mocha` is used in the gulp file, it will not be parsed correctly thus the tasks cannot be listed.\r\nBasically it's because atom's Task environment has `document` object but no `location`. This [confuses mocha][1] (See also mochajs/mocha#1654)\r\n\r\nA temporary workaround is to expose a fake `location` object to `global` in your gulpfile:\r\n\r\n```coffee\r\nGLOBAL.location =\r\n  href: process.cwd() + \"/\"\r\n``` \r\n\r\nA pretty corner case here, so not sure when and who will decide to fix it in which project. Just documented it here in case some one has the same problem.\r\n\r\n[1]: https://github.com/mochajs/mocha/blob/b8ed82c70c995e5581cd9126fcea0d7bbeb085a9/lib/utils.js#L643"}}