Babel / Mocha:摩卡在全球安装,但describe()没有定义
我试图运行一个testing,我得到这个错误:
/dev/tests/counters.spec.js:12 describe('Work damn you!', function () { ^ ReferenceError: describe is not defined
摩卡在全球和本地安装到项目中。 我不确定是否正确,但是这是我的testing脚本:
"test": "mocha --compilers js:babel-register --require dev/tests/counters.spec.js"
我会去做任何明显错误的事情吗? 任何帮助将受到欢迎。
在package.json
试试这个configuration:
{ // ... "test": "mocha dev/tests/counters.spec.js --compilers js:babel-register" // ... }
--require
选项用于包含像should
这样的模块,但不包括unit testing文件。 查看更多关于这个选项。