Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

npm test fails with SyntaxError: Unexpected token * #27

Closed
markwaddle opened this issue Oct 26, 2016 · 4 comments
Closed

npm test fails with SyntaxError: Unexpected token * #27

markwaddle opened this issue Oct 26, 2016 · 4 comments

Comments

@markwaddle
Copy link

markwaddle commented Oct 26, 2016

$ npm test
> [email protected] test /Users/mark/src/mocha-phantomjs-core
> mocha --compilers coffee:coffee-script/register test/core.tests.coffee -t 5000

/Users/mark/src/mocha-phantomjs-core/test/core.tests.coffee:54
'returns a failure code and shows usage when no args are given', function*() {
                                                                         ^
SyntaxError: Unexpected token *
  at exports.runInThisContext (vm.js:73:16)
  at Module._compile (module.js:443:25)
  at Object.loadFile (/Users/mark/src/mocha-phantomjs-core/node_modules/coffee-script/lib/coffee-script/register.js:16:19)
  at Module.load (/Users/mark/src/mocha-phantomjs-core/node_modules/coffee-script/lib/coffee-script/register.js:45:36)
  at Function.Module._load (module.js:310:12)
  at Module.require (module.js:365:17)
  at require (module.js:384:17)
  at /usr/local/Cellar/nvm/0.31.2/versions/node/v0.12.16/lib/node_modules/mocha/lib/mocha.js:222:27
  at Array.forEach (native)
  at Mocha.loadFiles (/usr/local/Cellar/nvm/0.31.2/versions/node/v0.12.16/lib/node_modules/mocha/lib/mocha.js:219:14)
  at Mocha.run (/usr/local/Cellar/nvm/0.31.2/versions/node/v0.12.16/lib/node_modules/mocha/lib/mocha.js:487:10)
  at Object.<anonymous> (/usr/local/Cellar/nvm/0.31.2/versions/node/v0.12.16/lib/node_modules/mocha/bin/_mocha:458:18)
  at Module._compile (module.js:460:26)
  at Object.Module._extensions..js (module.js:478:10)
  at Module.load (module.js:355:32)
  at Function.Module._load (module.js:310:12)
  at Function.Module.runMain (module.js:501:10)
  at startup (node.js:129:16)
  at node.js:814:3

npm ERR! Test failed.  See above for more details.
$ npm list                                                                                                                                       
[email protected] /Users/mark/src/mocha-phantomjs-core
├── [email protected]
├─┬ [email protected]
│ ├── [email protected]
│ └─┬ [email protected]
│   └── [email protected]
├─┬ [email protected]
│ ├── [email protected]
│ └── [email protected]
├── [email protected]
├── UNMET PEER DEPENDENCY mocha@>=1.18 <3
├── [email protected] extraneous
└── [email protected]

npm ERR! peer dep missing: mocha@>=1.18 <3, required by [email protected]
npm ERR! extraneous: [email protected] /Users/mark/src/mocha-phantomjs-core/node_modules/mocha-phantomjs

I'm on Mac OS Sierra 10.12.1, so I need to use phantomjs 2.

$ phantomjs --version                                                                                                                            
2.1.1
@markwaddle markwaddle changed the title npm test fails with SyntaxError: Unexpected token * npm test fails with SyntaxError: Unexpected token * Oct 26, 2016
@nathanboktae
Copy link
Owner

Phantomjs 2 doesn't support ES6. Use ES5 or compile with babel or the like.

@markwaddle
Copy link
Author

markwaddle commented Oct 26, 2016

any suggestions on how to do so? thanks!

@markwaddle
Copy link
Author

@nathanboktae: after some more consideration, it is unclear to me what i am doing wrong. i expected to be able to pull the latest from master and run the tests with npm test. is there something i am missing?

@nathanboktae
Copy link
Owner

nathanboktae commented Oct 27, 2016

This is not the place to explain how JavaScript and browsers work so I'll be brief. PhantomJS 2 is a headless browser based on QT5 WebKit and JavaScriptCore. JavaScript (officially called ECMAScript) is evolving. You are using generator functions, a feature of ES6. PhantomJS 2 only supports ES5 - but will in 2.5 according to ariya/phantomjs#14506

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants