Both of these links have tutorials on using mocha with babel compiler and both don't work, and likely haven't worked since 2015:
http://redux.js.org/docs/recipes/WritingTests.html
https://onsen.io/blog/mocha-chaijs-unit-test-coverage-es6/
mocha --compilers js:babel/register
Because it took a deep google search to find the solution. I'm making this SO QA.
It's now babel-core/register.
mocha --compilers js:babel-core/register
The answer can be found here https://phabricator.babeljs.io/T2685
EDIT: I see now Redux's tutorial works. I had a typo on with "script" in npm, that should have been "scripts". So you can also run the following command:
mocha --compilers js:babel-register
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With