Protractor throwing unexpected token export
<p>I'm trying to get a protactor test running. But when making use of module it throws the below. I'm quite new to ES6 how to configure it.</p>

<blockquote>
  <p>export { getFreePort };
  ^^^^^^
  SyntaxError: Unexpected token export
      at Object.exports.runInThisContext (vm.js:76:16)
      at Module._compile (module.js:513:28)
      at Module._extensions..js (module.js:550:10)
      at Object.require.extensions.(anonymous function) [as .js] (C:\Dev\Code\JG.Crowdfunding.Website\node_modules\babel-register\lib\node.js:156:7)
      at Module.load (module.js:458:32)
      at tryModuleLoad (module.js:417:12)
      at Function.Module._load (module.js:409:3)
      at Module.require (module.js:468:17)
      at require (internal/module.js:20:19)
      at Object. (C:\Dev\Code\JG.Crowdfunding.Website\protractor.conf.js:4:18)</p>
</blockquote>

<p>My babelrc file has</p>

<pre><code>{ "presets": ["es2015"] }
</code></pre>

<p>The imported file where the error occurs looks like</p>

<pre><code>var freeport = require('freeport');

var getFreePort = function () {
return new Promise((fulfill, reject) =&gt; {
    freeport((err, port) =&gt; {
        if (err) {
            console.log('ERROR: Something went wrong while trying to find a free port.');
            reject(err);
        }
        fulfill(port);
    });
});
};

export { getFreePort };
</code></pre>

<p>And inside my protractor.conf onPrepare function I have.</p>

<pre><code>  onPrepare: function () {
return portHelper.getFreePort().then(port =&gt; {
  fakeApiServer.startFakeApiServer(port);
}).then(() =&gt; {
  return browser.driver.manage().window().maximize();
})}
</code></pre>

<p>and I'm doing the following further up in the protractor.conf</p>

<pre><code>require('babel-core/register');
var portHelper = require('./test/e2e/helpers/portHelper');
</code></pre>

<p>Thanks</p>