danthareja / contribute-to-open-source-server

The ironically undocumented server powering https://github.com/danthareja/contribute-to-open-source
MIT License
1 stars 1 forks source link

Syntax Error in calculator.test.js preventing mocha tests from running #9

Closed veronix closed 4 years ago

veronix commented 5 years ago

In calculator.test.js I changed

describe.skip('_check', () => { to describe.only('_check', () => {

and then ran 'npm test' to see if it passes the tests. It gave me a result stating a syntax error instead of running mocha tests.

screenshot

I was expecting to see it output failing other (mocha) tests. Even after completing resolving the issue by implementing _check(), the syntax error from the test file (calculator.test.js) prevented the tests from running. What could the issue be?

Note: I am running npm v1.4.28 and nodejs v0.10.37 from Win10's Unix shell terminal.

Thank you.

danthareja commented 5 years ago

Thanks for the report @veronix! The problem here is your node version (nice job putting the version information inside of your description, it made this very easy to figure out!)

The syntax it's caught on is an arrow function introduced in the ES2015 language specification. Node v0.10 is very outdated and does not support the adoption of new language features that have been released in the past few years (source: https://node.green/#ES2015-functions-arrow-functions)

I would recommend that you update Node to the current Long Term Support version (v10). You can do this by following the download link on https://nodejs.org/en/

Once you update, you should be able to run npm test just fine! Let me know if you have any more questions/issues