{"action":"opened","issue":{"url":"https://api.github.com/repos/xolvio/chimp/issues/489","repository_url":"https://api.github.com/repos/xolvio/chimp","labels_url":"https://api.github.com/repos/xolvio/chimp/issues/489/labels{/name}","comments_url":"https://api.github.com/repos/xolvio/chimp/issues/489/comments","events_url":"https://api.github.com/repos/xolvio/chimp/issues/489/events","html_url":"https://github.com/xolvio/chimp/issues/489","id":181467172,"number":489,"title":"webdriver execute() fails due to babel require hook","user":{"login":"acthp","id":494506,"avatar_url":"https://avatars.githubusercontent.com/u/494506?v=3","gravatar_id":"","url":"https://api.github.com/users/acthp","html_url":"https://github.com/acthp","followers_url":"https://api.github.com/users/acthp/followers","following_url":"https://api.github.com/users/acthp/following{/other_user}","gists_url":"https://api.github.com/users/acthp/gists{/gist_id}","starred_url":"https://api.github.com/users/acthp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/acthp/subscriptions","organizations_url":"https://api.github.com/users/acthp/orgs","repos_url":"https://api.github.com/users/acthp/repos","events_url":"https://api.github.com/users/acthp/events{/privacy}","received_events_url":"https://api.github.com/users/acthp/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-10-06T16:42:40Z","updated_at":"2016-10-06T16:42:40Z","closed_at":null,"body":"It's a bit hard to tell, but it looks to me like chimp is loading babel-register, which invokes babel on all the test modules. I can tell that the test modules are being transpiled by calling toString() on a function in a test module that has babel language features: the string has babel symbols embedded in it.\r\n\r\nThis becomes a problem when calling execute(), because the function is sent to the browser for evaluation, and the babel symbols are undefined in that context.\r\n\r\nIn the example below, chrome already has Object.keys(), so it should work, but it fails because Object.keys has been rewritten to a babel function which is undefined in the browser.\r\n\r\nFixes might be 1) inject the babel functions in the browser context that injects the execute() function, or 2) some way to prevent babel from transforming the argument to execute().\r\n\r\n#####  Expected behaviour\r\n\r\nwebdriver execute() runs js in the browser.\r\n\r\n#####  Actual behaviour\r\n\r\nErrors thrown in browser due to undefined babel symbols.\r\n\r\n##### Steps to reproduce the problem\r\n\r\nSomething like\r\n\r\nbrowser.execute(function () { return Object.keys({foo: 'bar'}); })\r\n\r\n\r\n#####  Used version\r\n\r\n* Chimp: 0.41.1\r\n* Node.js: 4.0.0\r\n* Operation system: linux / osx\r\n\r\n#####  Console / Log Output\r\n\r\n(Upload long logs to [Gist](https://gist.github.com/) and link it here)\r\n\r\n<!-- please leave the content below this line as it helps others find help -->\r\n------- \r\n*Join our Slack [xolv.io/community](http://xolv.io/community) #chimp channel, where you can find help and help others.*\r\n"}}
{"actor":{"display_login":"acthp"}}