ERROR :

我使用业力和茉莉花进行一些unit testing。 我想要一个html输出,而不是检查控制台/terminal,并发现这个: https : //www.npmjs.org/package/karma-htmlfile-reporter这是完美的我的要求。

当我运行它时,我得到一个错误:

`ERROR [karma]: [TypeError: Cannot call method 'push' of undefined] TypeError: Cannot call method 'push' of undefined at onBrowserStart (/usr/local/lib/node_modules/karma/lib/reporters/base.js:14:20) at null.<anonymous> (/usr/local/lib/node_modules/karma/lib/events.js:15:22) at EventEmitter.emit (events.js:117:20) at onStart (/usr/local/lib/node_modules/karma/lib/browser.js:128:13) at Socket.<anonymous> (/usr/local/lib/node_modules/karma/lib/events.js:15:22) at Socket.EventEmitter.emit [as $emit] (events.js:117:20) at SocketNamespace.handlePacket (/usr/local/lib/node_modules/karma/node_modules/socket.io/lib/namespace.js:335:22) at Manager.onClientMessage (/usr/local/lib/node_modules/karma/node_modules/socket.io/lib/manager.js:488:38) at WebSocket.Transport.onMessage (/usr/local/lib/node_modules/karma/node_modules/socket.io/lib/transport.js:387:20) at Parser.<anonymous> (/usr/local/lib/node_modules/karma/node_modules/socket.io/lib/transports/websocket/hybi-16.js:39:10) 

我已经在谷歌寻找答案,但还没有find一个,如果我从configuration中的报告中删除'HTML',它工作正常。 我之前没有用过茉莉花/业力,所以不确定在哪里寻求帮助。

与报告相关的configuration部分:`

  reporters: ['progress', 'html'], htmlReporter: { outputFile: 'tests/units.html' },`` 

感谢您的帮助。

我转换到业力0.10,一切正常。

 $ npm uninstall karma 

并在项目根目录下运行:

 $ npm install karma@0.10 

祝你好运