{"action":"closed","issue":{"url":"https://api.github.com/repos/getgauge-contrib/gauge-js/issues/39","repository_url":"https://api.github.com/repos/getgauge-contrib/gauge-js","labels_url":"https://api.github.com/repos/getgauge-contrib/gauge-js/issues/39/labels{/name}","comments_url":"https://api.github.com/repos/getgauge-contrib/gauge-js/issues/39/comments","events_url":"https://api.github.com/repos/getgauge-contrib/gauge-js/issues/39/events","html_url":"https://github.com/getgauge-contrib/gauge-js/issues/39","id":138330774,"number":39,"title":"How to use module.exports?","user":{"login":"philipbeadle","id":5264862,"avatar_url":"https://avatars.githubusercontent.com/u/5264862?v=3","gravatar_id":"","url":"https://api.github.com/users/philipbeadle","html_url":"https://github.com/philipbeadle","followers_url":"https://api.github.com/users/philipbeadle/followers","following_url":"https://api.github.com/users/philipbeadle/following{/other_user}","gists_url":"https://api.github.com/users/philipbeadle/gists{/gist_id}","starred_url":"https://api.github.com/users/philipbeadle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/philipbeadle/subscriptions","organizations_url":"https://api.github.com/users/philipbeadle/orgs","repos_url":"https://api.github.com/users/philipbeadle/repos","events_url":"https://api.github.com/users/philipbeadle/events{/privacy}","received_events_url":"https://api.github.com/users/philipbeadle/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":15,"created_at":"2016-03-03T23:36:50Z","updated_at":"2016-06-10T06:31:59Z","closed_at":"2016-06-10T06:31:59Z","body":"Hi :)\r\nHow do i use module.exports so i can set up things like a common instance of a browser driver.  I'd like to do this.\r\n\r\n```\r\nvar driver;\r\nmodule.exports = function () {\r\n  if (!driver) {\r\n    driver = require('webdriverjs-angular');\r\n    var options = {\r\n      desiredCapabilities: {\r\n        browserName: 'chrome'\r\n      },\r\n      ngRoot: 'body' // main application selector\r\n    };\r\n    console.log('test');\r\n    driver\r\n      .remote(options)\r\n      .init()\r\n      .url('http://127.0.0.1:8080/').then(function () {\r\n      return driver;\r\n    });\r\n  } else {\r\n    return driver\r\n      .url('http://127.0.0.1:8080/').then(function () {\r\n        return driver;\r\n      });\r\n  }\r\n};\r\n```\r\nBut I keep getting\r\n```\r\ndriver.js:2\r\nmodule.exports = function () {\r\n^\r\nReferenceError: module is not defined\r\n    at driver.js:2:1\r\n    at ContextifyScript.Script.runInNewContext (vm.js:38:15)\r\n    at Object.exports.runInNewContext (vm.js:69:17)\r\n    at VM.run (/Users/PhilBeadle/.gauge/plugins/js/1.1.0/src/vm.js:19:6)\r\n    at VM.runFile (/Users/PhilBeadle/.gauge/plugins/js/1.1.0/src/vm.js:24:8)\r\n    at /Users/PhilBeadle/.gauge/plugins/js/1.1.0/src/impl-loader.js:9:8\r\n    at Array.forEach (native)\r\n    at Object.loadImpl [as load] (/Users/PhilBeadle/.gauge/plugins/js/1.1.0/src/impl-loader.js:7:68)\r\n    at run (/Users/PhilBeadle/.gauge/plugins/js/1.1.0/src/gauge.js:11:15)\r\n    at Object.<anonymous> (/Users/PhilBeadle/.gauge/plugins/js/1.1.0/src/gauge.js:26:3)\r\n\r\n```\r\n\r\nCheers\r\nPhil"}}
{"actor":{"display_login":"kaustavdm"}}