mocha --compilers js:babel/register “cannot find module”

你。 提交于 2019-12-10 20:09:53

问题


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

回答1:


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


来源:https://stackoverflow.com/questions/38517590/mocha-compilers-jsbabel-register-cannot-find-module

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!