Unexpected token error when running tests


#1

Hi all! Let me preface with the usual disclaimers: 1) I do not have a lot coding in my past, and 2) I had never even heard of Protractor prior to Webtestit.

Here’s the problem I’m having: I just installed Webtestit and created a couple of new projects yesterday. I finally got all the syntax errors out of my test files, but when I try to execute them, I am receiving an “Unespected token function” error that is apparently related to the endpoint setup. Here is what I am seeing:

[09:45:05] E/configParser - Error message: failed loading configuration file protractor.conf.js

[09:45:05] E/configParser - C:\Ranorex\WebTestItFirst Try\ts-demoshop\protractor-helpers.js:12
onPrepare: async function () {
^^^^^^^^

SyntaxError: Unexpected token function
at createScript (vm.js:56:10)
at Object.runInThisContext (vm.js:97:10)
at Module._compile (module.js:542:28)
at Object.Module._extensions…js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object. (C:\Ranorex\WebTestItFirst Try\ts-demoshop\protractor.conf.js:4:17)

I thought maybe I had messed up a file somewhere, but I’m getting the same error out of the ts-demoshop project.
I’ve tried using both chrome and ff as the endpoint, but I get the same results.

Any assistance would be greatly appreciated. I’m supposed to do a demo for my boss on Friday.

Thanks!


#2

Hello @jandersonacep1!
Could you please tell us is this happening when you download our TypeScript demo-shop example and try to run it without modifying anything?
Also, try to update your Node.js version to the latest one, if you haven’t done it already, restart Ranorex Webtestit and try to run the tests again.
If the issue is still there, could you possibly send us the project that contains the above-mentioned error, so that we could have a closer look and help you out :slight_smile:
Kind regards


#3

Thanks for the reply, @smatijas. Updating the Node.js fixed the problem.


closed #4