javascript - Protractor throwing unexpected token export -


i'm trying protactor test running. when making use of module throws below. i'm quite new es6 how configure it.

export { getfreeport }; ^^^^^^ syntaxerror: unexpected token export @ object.exports.runinthiscontext (vm.js:76:16) @ module._compile (module.js:513:28) @ module._extensions..js (module.js:550:10) @ object.require.extensions.(anonymous function) [as .js] (c:\dev\code\jg.crowdfunding.website\node_modules\babel-register\lib\node.js:156:7) @ module.load (module.js:458:32) @ trymoduleload (module.js:417:12) @ function.module._load (module.js:409:3) @ module.require (module.js:468:17) @ require (internal/module.js:20:19) @ object. (c:\dev\code\jg.crowdfunding.website\protractor.conf.js:4:18)

my babelrc file has

{ "presets": ["es2015"] } 

the imported file error occurs looks like

var freeport = require('freeport');  var getfreeport = function () { return new promise((fulfill, reject) => {     freeport((err, port) => {         if (err) {             console.log('error: went wrong while trying find free port.');             reject(err);         }         fulfill(port);     }); }); };  export { getfreeport }; 

and inside protractor.conf onprepare function have.

  onprepare: function () { return porthelper.getfreeport().then(port => {   fakeapiserver.startfakeapiserver(port); }).then(() => {   return browser.driver.manage().window().maximize(); })} 

and i'm doing following further in protractor.conf

require('babel-core/register'); var porthelper = require('./test/e2e/helpers/porthelper'); 

thanks

in line, need port in parentheses: return porthelper.getfreeport().then(port => {


Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -