Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/unit-testing/4.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
Node.js 业力测试通过,但npm测试给出错误_Node.js_Unit Testing_Angular_Npm_Karma Runner - Fatal编程技术网

Node.js 业力测试通过,但npm测试给出错误

Node.js 业力测试通过,但npm测试给出错误,node.js,unit-testing,angular,npm,karma-runner,Node.js,Unit Testing,Angular,Npm,Karma Runner,我使用并且有如下问题:当我在项目目录中运行 karma start 然后我得到: 总结: ✔ 已完成0项测试 但当我跑步时: npm test 我得到: SUMMARY: ✔ 0 tests completed npm ERR! Darwin 16.1.0 npm ERR! argv "/usr/local/Cellar/node/7.1.0/bin/node" "/usr/local/bin/npm" "run" "t

我使用并且有如下问题:当我在项目目录中运行

karma start
然后我得到:

总结:

✔ 已完成0项测试

但当我跑步时:

npm test
我得到:

SUMMARY:
✔ 0 tests completed

npm ERR! Darwin 16.1.0
npm ERR! argv "/usr/local/Cellar/node/7.1.0/bin/node" "/usr/local/bin/npm" "run" "test"
npm ERR! node v7.1.0
npm ERR! npm  v4.0.2
npm ERR! code ELIFECYCLE
npm ERR! angular2-webpack-starter@5.0.5 test: `karma start`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the angular2-webpack-starter@5.0.5 test script 'karma start'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the angular2-webpack-starter package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     karma start
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs angular2-webpack-starter
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls angular2-webpack-starter
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/Kamil/Desktop/Code/officewise/officewise_frontend/npm-debug.log
总结:

✔ 已完成0项测试

npm错误!测试失败。请参见上文了解更多详细信息

如果我跑步:

npm run test
我得到:

SUMMARY:
✔ 0 tests completed

npm ERR! Darwin 16.1.0
npm ERR! argv "/usr/local/Cellar/node/7.1.0/bin/node" "/usr/local/bin/npm" "run" "test"
npm ERR! node v7.1.0
npm ERR! npm  v4.0.2
npm ERR! code ELIFECYCLE
npm ERR! angular2-webpack-starter@5.0.5 test: `karma start`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the angular2-webpack-starter@5.0.5 test script 'karma start'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the angular2-webpack-starter package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     karma start
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs angular2-webpack-starter
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls angular2-webpack-starter
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/Kamil/Desktop/Code/officewise/officewise_frontend/npm-debug.log

你知道如何消除这个npm错误吗?这对我来说很重要,因为我使用一些外部系统来运行测试并报告存储库中新提交的错误(我的节点版本v7.1.0(最新版本)、npm版本4.0.2(最新版本)、Mac OS Sierra)。

默认情况下,如果没有要运行的测试,Karma将带着错误退出

要禁用此行为,您需要将此行添加到您的Karma配置中:

failOnEmptyTestSuite: false

默认情况下,如果没有要运行的测试,Karma将带着错误退出

要禁用此行为,您需要将此行添加到您的Karma配置中:

failOnEmptyTestSuite: false

您是否在本地和全局安装了相同版本的
karma
?版本是相同的全局和本地版本:karma版本:0.13.22您是否尝试过删除
node_模块
,运行
npm cache clear
,然后执行
npm install
?我尝试过这个-出现相同的错误…:(@KamilKiełczewski这是一个很长的机会,但是你还记得你是否解决了错误吗?如果是,你还记得你做了什么吗?谢谢!你在本地和全局安装了相同版本的
karma
吗?版本是相同的全局和本地:karma版本:0.13.22你是否尝试过删除
node_模块
,运行
npm cache cl>ear
,然后是
npm安装
?我尝试了这个-steel同样的错误…:(@KamilKiełczewski这是一个很长的机会,但是你还记得你是否解决了错误吗?如果是,你还记得你做了什么吗?谢谢!