摩卡--compilers js:babel/注册“找不到模块" [英] mocha --compilers js:babel/register "cannot find module"
问题描述
这两个链接都有关于将Mocha与babel编译器一起使用的教程,并且两者都不起作用,而且自2015年以来可能就不起作用了.
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
推荐答案
因为在Google上进行了深入搜索才能找到解决方案.我正在执行此质量检查.
Because it took a deep google search to find the solution. I'm making this SO QA.
现在是babel-core/register.
It's now babel-core/register.
mocha --compilers js:babel-core/register
答案可以在这里找到 https://phabricator.babeljs.io/T2685
The answer can be found here https://phabricator.babeljs.io/T2685
我现在看到Redux的教程有效.我在npm中输入了"script",这应该是"scripts".因此,您还可以运行以下命令:
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
这篇关于摩卡--compilers js:babel/注册“找不到模块"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!