dtabuenc / karma-html-reporter

Karma Html Reporter Plugin
MIT License
45 stars 30 forks source link

This reporter causes karma to crash for small errors. #13

Closed andrew-luhring closed 9 years ago

andrew-luhring commented 10 years ago

Example:

INFO [launcher]: Starting browser Chrome
INFO [Chrome 35.0.1916 (Mac OS X 10.8.5)]: Connected on socket EK2rYY15FeDz98z-wxD4 with id 75186479
Chrome 35.0.1916 (Mac OS X 10.8.5) ERROR
  Uncaught Error: Module name "user.controller" has not been loaded yet for context: _
  http://requirejs.org/docs/errors.html#notloaded
  at /Users/user/Sites/project/node_modules/requirejs/require.js:141
ERROR [karma]: [TypeError: Cannot set property 'results' of undefined]
TypeError: Cannot set property 'results' of undefined
    at onBrowserComplete (/Users/user/Sites/project/node_modules/karma-html-reporter/index.js:43:25)
    at null.<anonymous> (/Users/user/Sites/project/node_modules/karma/lib/events.js:15:22)
    at EventEmitter.emit (events.js:117:20)
    at onComplete (/Users/user/Sites/project/node_modules/karma/lib/browser.js:145:13)
    at Socket.<anonymous> (/Users/user/Sites/project/node_modules/karma/lib/events.js:15:22)
    at Socket.EventEmitter.emit [as $emit] (events.js:117:20)
    at SocketNamespace.handlePacket (/Users/user/Sites/project/node_modules/karma/node_modules/socket.io/lib/namespace.js:335:22)
    at Manager.onClientMessage (/Users/user/Sites/project/node_modules/karma/node_modules/socket.io/lib/manager.js:518:38)
    at WebSocket.Transport.onMessage (/Users/user/Sites/project/node_modules/karma/node_modules/socket.io/lib/transport.js:369:20)
    at Parser.<anonymous> (/Users/user/Sites/project/node_modules/karma/node_modules/socket.io/lib/transports/websocket/hybi-16.js:39:10)

Also crashes if an extra }, ) function, var f = ; etc. All small errors. Karma does not crash if this reporter is disabled. Just a heads up.

chmartinez commented 10 years ago

I have the same issue as well. I have to deactivate the reporter to make it work

ofrogon commented 10 years ago

I got the same issue whit that reporter, on Windows with Chrome version 36. This seem to affect only Chrome because the test I done on IE and Firefox work well.

This crash is the only reason why I dont use this reporter because his output format is awesome.

darlesson commented 10 years ago

I got the same error using PhantomJS. This error goes and comes back if I update a NPM package or change a node_module file. It seems to go away if I change browsers in karma config to another browser, run grunt karma, and then change back to what I had before.

After some investigation the error happens in onBrowserComplete method when browserResults is an empty object even though the browser argument is not. var browserResult = browserResults[browser.id]; returns undefined. The reference to browserResult.results in the next line causes the error.

The question is why browserResults has no browser assigned to it event though browser is not empty.

I am using the version "0.2.4".

dtabuenc commented 9 years ago

This has been fixed in 0.2.6