Disconnected (1 times), because no message in 10000 ms using Karma-Jasmine

匿名 (未验证) 提交于 2019-12-03 01:10:02

问题:

Using Karma runner with jasmine. After all the configuration done, I type on terminal the below command:

karma start public/javascripts/karma.conf.js 

But I am getting the below error where my browser is getting closed.

INFO [karma]: Karma v0.12.16 server started at http://localhost:9876/ INFO [launcher]: Starting browser Chrome INFO [Chrome 34.0.1847 (Mac OS X 10.9.2)]: Connected on socket hDO3pMdVNGcBMDx4FI0w with id 60695552 WARN [Chrome 34.0.1847 (Mac OS X 10.9.2)]: Disconnected (1 times), because no message in 10000 ms. 

I changed the browserNoActivityTimeout in Karma config to 50 seconds but still the same error. Its happening for both safari and chrome. I have not tried for other browsers.

I could not find much input fro other github threads on the same issue. Like changing port does not help either.

Karma Version: 0.12.16 Nodejs version: 0.10.22 Mac OS: 10.9.2 

Has anyone faced the same issue?

回答1:

found the issue and resolve it. This was because requirejs was not included in the karma config where as all my controllers are getting loaded by requirejs. After including it in the frameworks, the issue was gone. I faced few more issues after that but was able to resolve and run a sample test case. i had to add "requirejs" in frameworks section in the karma conf file:: frameworks: ['jasmine', 'requirejs']



回答2:

I solved this issue by update my node from 10.4 to 12.2. It appears the socket.io that karma pull via npm was not compiling. I had run karma on two other machines just fine but the two with the 10.4 version of node had the warning below:

karma\node_modules\socket.io\node_modules\socket.io-client\node_modules\ws\node_modules\nan\nan.h(1103): warning C4267: 'initializing' : conversion from 'size_t' to 'int', possible loss of data

karma\node_modules\socket.io\node_modules\socket.io-client\node_modules\ws\build\bufferutil.vcxproj warning C4267: 'initializing' : conversion from 'size_t' to 'int', possible loss of data

karma\node_modules\socket.io\node_modules\socket.io-client\node_modules\ws\build\bufferutil.vcxproj]

I did not bother tracking down whether it was the node version that was the problem or the npm version since npm gets upgraded by default when one upgrades node. Either way, upgrading node fixed the issue for me. If you have a hard dependency to 10.4 or whatever version of node you are one, try updating just your npm to a compartible version.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!