mocha_factory.js is returning an error
What are you trying to achieve?
I'm just have tried to run my steps using a "mochawesome" to generate the reports.
What do you get instead?
SyntaxError: Unexpected token )
Provide console output if related. Use
--verbosemode for more details.
codeceptjs run --steps --reporter mochawesome
E:\Java\SasWebCodecept\node_modules\codeceptjs\lib\mocha_factory.js:41
);
^
SyntaxError: Unexpected token )
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.<anonymous> (E:\Java\SasWebCodecept\node_modules\codeceptjs\lib\container.js:4:22)
npm ERR! Windows_NT 10.0.15063
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
npm ERR! node v6.11.2
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
Provide test source code if related
// paste test
Details
- CodeceptJS version: ^1.0.3
- NodeJS Version: v8.2.1
- Operating System: Windows 10 Professional
- Protractor || WebDriverIO || Nightmare version (if related) : "webdriverio": "^4.9.11"
- Configuration file:
My solution for this !
Just change the version on package.json unfortunately now I need to use the "codeceptjs":"1.0.2"
I'm getting the same issue with : Node v7.6.0 CodeceptJS v1.0.3 and v1.0.2 (tried both)
@XDevelopers & @daniellevautier - I have had the same issue with Node v6.9.5 on macOS. After updating to the last stable version of Node (v9.2.1), I am not experiencing this issue anymore.
Thank you
In my case I've just get the previous version from Codecept and works to me...
This happens because your node version should be at least 8.9+ I had the same problem and after updating all works good.
@XDevelopers which codecept version did you roll back to?
Can you retry with v1.1.1 and with at least Node 8.9+?
I've been running it on MacOS and Win 7 with no problems.
Following fix worked for me. you better try.
Open
node_modules\codeceptjs-nightmare\node_modules\codeceptjs\lib\mocha_factory.js
in text editor.
There is an additional comma in line 41. Remove it.
attributes, <-- here
Enjoy.!!!
Funny enough the call to Object.defineProperty works fine with a trailing comma with Node 8.9.3 (at least from the command prompt in node). So maybe there is a deference in processing the function between the older node versions.
Did you manage to upgrade node as well? Or did you just remove the trailing comma?
@chathurangamdk thanks for pointing out. removing trailing comma worked.
This is not longer a problem when using Node 8.9.1 or above. And CodeceptJS ≥V1.1.0 only supports Node ≥8.9.1. So I'll close this issue.
This is issue related to NodeJS version... I resolved mine after updating to latest node (v10.6.0)