{"action":"created","issue":{"url":"https://api.github.com/repos/wallabyjs/public/issues/362","labels_url":"https://api.github.com/repos/wallabyjs/public/issues/362/labels{/name}","comments_url":"https://api.github.com/repos/wallabyjs/public/issues/362/comments","events_url":"https://api.github.com/repos/wallabyjs/public/issues/362/events","html_url":"https://github.com/wallabyjs/public/issues/362","id":119226792,"number":362,"title":"Browserify, Babel, Mocha, Node - \"window is not defined\"","user":{"login":"jrsearles","id":2739655,"avatar_url":"https://avatars.githubusercontent.com/u/2739655?v=3","gravatar_id":"","url":"https://api.github.com/users/jrsearles","html_url":"https://github.com/jrsearles","followers_url":"https://api.github.com/users/jrsearles/followers","following_url":"https://api.github.com/users/jrsearles/following{/other_user}","gists_url":"https://api.github.com/users/jrsearles/gists{/gist_id}","starred_url":"https://api.github.com/users/jrsearles/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jrsearles/subscriptions","organizations_url":"https://api.github.com/users/jrsearles/orgs","repos_url":"https://api.github.com/users/jrsearles/repos","events_url":"https://api.github.com/users/jrsearles/events{/privacy}","received_events_url":"https://api.github.com/users/jrsearles/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/wallabyjs/public/labels/question","name":"question","color":"cc317c"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-11-27T17:13:45Z","updated_at":"2015-11-27T22:51:34Z","closed_at":null,"body":"I have a repo the uses Browserify and Babel with mocha node tests. I've been trying to get Wallaby going using Visual Studio Code on windows but am hitting roadblocks. Here is my config:\r\n\r\n```js\r\nmodule.exports = function (wallaby) {\r\n\treturn {\r\n\t\tfiles: [{\r\n\t\t\tpattern: \"src/**/*.js\",\r\n\t\t\tload: false\r\n\t\t},\r\n\t\t{\r\n\t\t\tpattern: \"index.js\",\r\n\t\t\tload: false\r\n\t\t}],\r\n\t\t\r\n\t\ttests: [{\r\n\t\t\tpattern: \"test/**/*.js\",\r\n\t\t\tload: false\t\t\r\n\t\t}],\r\n\t\t\r\n\t\tcompilers: {\r\n\t\t\t\"**/*.js\": wallaby.compilers.babel({\r\n\t\t\t\tbabel: babel\r\n\t\t\t})\r\n\t\t},\r\n\t\t\r\n\t\ttestFramework: \"mocha\",\r\n\t\t\r\n\t\tpostprocessor: wallabify({entries: [\"./index.js\"], ignoreMissing: true}),\r\n\t\t\r\n\t\tbootstrap: function () {\r\n\t\t\twindow.__moduleBundler.loadTests();\r\n\t\t},\r\n\t\t\r\n\t\tdebug: true,\r\n\t\t\r\n\t\tenv: {\r\n\t\t\ttype: \"node\"\r\n\t\t}\r\n\t};\r\n};\r\n```\r\n\r\nThe error i get is:\r\n\r\n​ReferenceError: window is not defined\r\n​    at emitTwo (events.js:87:13)\r\n​    at WebSocket.emit (events.js:172:7)\r\n\r\nWhich makes sense, however changing the bootstrap function to use `global` doesn't work. "},"comment":{"url":"https://api.github.com/repos/wallabyjs/public/issues/comments/160224011","html_url":"https://github.com/wallabyjs/public/issues/362#issuecomment-160224011","issue_url":"https://api.github.com/repos/wallabyjs/public/issues/362","id":160224011,"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},"created_at":"2015-11-27T22:51:34Z","updated_at":"2015-11-27T22:51:34Z","body":"Wallaby loads mocha before tests (to register reporter, hook up its handlers, etc.), so maybe the issue is related.\r\n\r\nTry adding this to your wallaby bootstrap function:\r\n\r\n``` JavaScript\r\nmodule.exports = function (wallaby) {\r\n    return {\r\n        ...\r\n    bootstrap: function () {\r\n      var modulePrototype = require('module').Module.prototype;\r\n      var originalRequire = modulePrototype.require;\r\n      modulePrototype.require = function (filePath) {\r\n        var exports = originalRequire.call(this, filePath);\r\n        if (filePath === 'mocha') {\r\n          exports.describe = global.describe;\r\n          exports.it = global.it;\r\n        }\r\n        return exports;\r\n      };\r\n    }\r\n    };\r\n};\r\n```\r\n\r\nBTW, mocha exports globals, so just commenting out the line:\r\n\r\n``` JavaScript\r\nimport {describe, it} from \"mocha\";\r\n```\r\nshould also work (in wallaby/gulp-mocha/command line)."}}