Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/37.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 摩卡咖啡测试_Javascript_Node.js_Coffeescript_Mocha.js_Assert - Fatal编程技术网

Javascript 摩卡咖啡测试

Javascript 摩卡咖啡测试,javascript,node.js,coffeescript,mocha.js,assert,Javascript,Node.js,Coffeescript,Mocha.js,Assert,我正在用摩卡和咖啡制作一个简单的测试脚本 在我的测试文件夹中,我有一个mocha mocha.opts的配置: 以及我的测试文件test_one.coffee: 但每当我经营摩卡咖啡。它返回给我这个: assert.js:93 throw new assert.AssertionError({ AssertionError: missing path at Module.require (module.js:363:3) at require (module.js:

我正在用摩卡和咖啡制作一个简单的测试脚本

在我的测试文件夹中,我有一个mocha mocha.opts的配置:

以及我的测试文件test_one.coffee:

但每当我经营摩卡咖啡。它返回给我这个:

assert.js:93

 throw new assert.AssertionError({ 

 AssertionError: missing path
     at Module.require (module.js:363:3)
     at require (module.js:380:17)
     at args (C:\...\AppData\Roaming\npm\node_modules\mocha\bi
     at Array.forEach (native)
     at Object.<anonymous> (C:\...\AppData\Roaming\npm\node_mo
     at Module._compile (module.js:456:26)
     at Object.Module._extensions..js (module.js:474:10)
     at Module.load (module.js:356:32)
     at Function.Module._load (module.js:312:12)
     at Function.Module.runMain (module.js:497:10)
     at startup (node.js:119:16)
     at node.js:929:3

有什么办法可以解决这个问题吗?

传递给摩卡的选项是:-编译器咖啡:咖啡脚本/注册。注意冒号后面缺少空格

我相信现在的情况是,有了这个空间,它告诉Mocha,要编译coffee文件,它应该加载一个路径为空字符串的模块,然后您就会得到您得到的错误。

作为任何查找此错误的人的参考

这几乎总是package.json中传递的字符串中的错误 我的看法是:

"test": "mocha --reporter spec --compilers ts:ts-node/register, 'test/**/*.test.ts'"
注意单词register后面的逗号

assert.js:93

 throw new assert.AssertionError({ 

 AssertionError: missing path
     at Module.require (module.js:363:3)
     at require (module.js:380:17)
     at args (C:\...\AppData\Roaming\npm\node_modules\mocha\bi
     at Array.forEach (native)
     at Object.<anonymous> (C:\...\AppData\Roaming\npm\node_mo
     at Module._compile (module.js:456:26)
     at Object.Module._extensions..js (module.js:474:10)
     at Module.load (module.js:356:32)
     at Function.Module._load (module.js:312:12)
     at Function.Module.runMain (module.js:497:10)
     at startup (node.js:119:16)
     at node.js:929:3
"test": "mocha --reporter spec --compilers ts:ts-node/register, 'test/**/*.test.ts'"