mocha --compilers js:babel/register"找不到模块"

Jas*_*ell 3 mocha.js babel ecmascript-6

这两个链接都有关于使用mocha和babel编译器的教程,两者都不起作用,自2015年以来可能没有用过:

http://redux.js.org/docs/recipes/WritingTests.html

https://onsen.io/blog/mocha-chaijs-unit-test-coverage-es6/

mocha --compilers js:babel/register
Run Code Online (Sandbox Code Playgroud)

Jas*_*ell 10

因为需要深入谷歌搜索才能找到解决方案.我正在制作这个SO QA.

它现在是babel-core/register.

mocha --compilers js:babel-core/register
Run Code Online (Sandbox Code Playgroud)

答案可以在这里找到 https://phabricator.babeljs.io/T2685

编辑:我现在看到Redux的教程有效.我在npm中输入了"脚本",这应该是"脚本".所以你也可以运行以下命令:

mocha --compilers js:babel-register
Run Code Online (Sandbox Code Playgroud)