shellscape/mocha-chrome

mocha-chrome: unexpected token

Closed this issue · 6 comments

Please note that this template is not optional. If you proceed with this form,
please fill out all fields, or your issue may be closed as "invalid."
Please do not delete this template. Please do remove this header to acknowledge this message.

  • Operating System: macOS Sierra 10.12.6
  • Node Version: v6.11.3
  • NPM Version: 3.10.10
  • mocha Version: 3.5.3
  • mocha-chrome Version: 0.2.1
  • chrome Version: 61.0.3163.100
  • This is a feature request
  • [x ] This is a bug

Code

  // code

Expected Behavior

mocha-chrome should run tests in html file

Actual Behavior

/Users/robhicks/.nvm/versions/node/v6.11.3/lib/node_modules/mocha-chrome/bin/mocha-chrome:89
(async function run () {
^^^^^^^^

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.runMain (module.js:604:10)
at run (bootstrap_node.js:389:7)
at startup (bootstrap_node.js:149:9)

For Bugs; How can we reproduce the behavior?

Run the mocha-chrome command in an environment like mine.

For Features; What is the motivation and/or use-case for the feature?

duplicate of #9, related to #8. @robhicks please do browse the closed issues and/or search before creating a new one 😉 good practice for all repos.

mocha-chrome requires node v7.6.0+. see https://github.com/shellscape/mocha-chrome/blob/master/package.json#L15

Maybe putting a requirement of node 7 would be good too!

@robhicks unfortunately that wouldn't be possible as node < v7.6.0 doesn't support the async/await pattern or keywords.

@shellscape I didn't ask support for node versions less than 7, although the LTS for node is 6.

I simply suggested documentation of the node >=7.x requirement in the readme.

@robhicks I think you left out the part about the readme in your previous comment 😉

package.json's engines field is one you should always be looking at. NPM will/should warn if there's an engine mismatch as well. many modules will adopt new features that are outside of LTS versions in maintenance mode, while some modules will choose to transpile to support those older versions. unfortunately I have no interest in supporting older versions as this time.

@robhicks I just open a PR to make it compatible with node 6.
#12