Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mocha --compilers js:babel/register "cannot find module"

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
like image 740
Sophie McCarrell Avatar asked Dec 18 '22 15:12

Sophie McCarrell


1 Answers

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
like image 71
Sophie McCarrell Avatar answered Apr 11 '23 23:04

Sophie McCarrell