jasmine-node
jasmine-node copied to clipboard
Run jasmine node with --harmony flag for ES6 generator support
I am currently trying to use jasmine-node to run nodejs 0.11.x code with generator support. Unfortunately, I can't just simply run jasmine-node --color --autotest --harmony server/tests/GeneratorSpec.js I was able to run manually using: node --harmony /lib/jasmine-node/cli.js --color server/tests/GeneratorSpec.js but when adding --autotest, it just throw the error: Unexpected token *] How i can run jasmine with hamony flag. Thanks!
In case if anyone has had the same problem, i was able to resolve it by by modifying the file 'autotest.js' of jasmine-node. Adding the --harmony flag so that child process will run node with harmony flag. baseArgv.splice(1, 0, '--harmony');
+1
+1
+1
+1
+1
+1
+1
Where does the line baseArgv.splice(1, 0, '--harmony'); get added in autotest.js?
+1
+1
+1
+1
+1
Since people are still +1-ing this...
First, ES6 generators are definitely working out of the box as of the node 7.3.0. A workaround for those features which are not available*, such as harmony_async_await is as follows.
Begin by locating the jasmine command with
where jasmine or which jasmine
For windows, grab the following lines
"%~dp0\node.exe" "%~dp0\node_modules\jasmine\bin\jasmine.js" %*
node "%~dp0\node_modules\jasmine\bin\jasmine.js" %*
and make them look like:
"%~dp0\node.exe" --harmony_async_await "%~dp0\node_modules\jasmine\bin\jasmine.js" %*
node --harmony_async_await "%~dp0\node_modules\jasmine\bin\jasmine.js" %*
Linux instructions should be rather similar. Actually i think Linux people can simply alias node out into node with the flags. http://www.linfo.org/alias.html
*I'm not sure what the autotest.js the OP was talking about