Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

200
Views
Syntax errror with arrow function

I am starting to work with protractor using jasmine, but I am instantly getting an 'unexpected token' error when it parses my config that uses arrow an arrow function. Does anyone know what I might be missing? Dependency? It's on a new macbook.I didn't have this problem on my old pc.

  exports.config = {
  framework: 'jasmine2',
  capabilities: env.capabilities,
  baseUrl: env.baseUrl,
  specs: env.specs,
  allScriptsTimeout: 30 * 10000,

 onPrepare: async () => {
     if (!global.jasmineRequire) {
         var jasmineRequire = require('jasmine-core');
         if (typeof jasmineRequire.interface !== 'function') {
            throw "not able to load real jasmineRequire"
        }
        global.jasmineRequire = jasmineRequire;
    }
    require('jasmine-promises'); await browser.get(env.baseUrl + 
    '#!/login');



   macs-iMac:e2etest AchieveIt$ protractor conf.js
   [08:03:45] E/configParser - Error code: 105
   [08:03:45] E/configParser - Error message: failed loading 
   configuration file conf.js
   [08:03:45] E/configParser - 
   /Users/mac/achieveit/E2ETests/e2etest/conf.js:13
   onPrepare: async ()=> {
               ^
  SyntaxError: Unexpected token (
   at createScript (vm.js:56:10)
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

UPDATE UPDATE

Never mind, I see you're using an object now. What is your compiler? I think your compiler is not compiling the es6 correctly. Make sure you have all your node modules installed correctly whether it's globally or locally. Your code should be valid, see this fiddle: https://es6console.com/j20jir0j/

UPDATE

Even in es6, you syntax is wrong. It should be:

onPrepare = async () => {

OLD for TS

That's not valid typescript and shouldn't work anywhere.

Change your line to:

onPrepare = (): async => {

Or if you don't need lexical scope:

onPrepare(): async {
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!