Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

203
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda