karma-runner / karma

Spectacular Test Runner for JavaScript
http://karma-runner.github.io
MIT License
11.96k stars 1.71k forks source link

Missing error handler on `socket` #2042

Open georgeedwards opened 8 years ago

georgeedwards commented 8 years ago

Expected behavior

My Travis CI build to complete the Jasmine Unit tests defined, reporting the number run and success vs. failure.

Actual behavior

This is the output from my build log. Here is the full build log. Also, here is the full github repository that was being built.

[09:39:04] Starting 'client.unit_test'...
05 04 2016 09:39:04.281:INFO [karma]: Karma v0.13.22 server started at http://localhost:9876/
05 04 2016 09:39:04.287:INFO [launcher]: Starting browser Chrome
05 04 2016 09:39:05.519:INFO [Chrome 49.0.2623 (Linux 0.0.0)]: Connected on socket /#7wcOJ3uFvZX-HgZeAAAA with id 49035067
Missing error handler on `socket`.
TypeError: (msg || "").replace is not a function
  at /home/travis/build/georgeedwards/Gen-App/node_modules/karma/lib/reporter.js:45:23
  at [object Object].onBrowserError (/home/travis/build/georgeedwards/Gen-App/node_modules/karma/lib/reporters/base.js:58:60)

Enviroment Details

├── karma@0.13.22 
├── karma-chrome-launcher@0.1.12 
├── karma-coverage@0.2.7 
├── karma-firefox-launcher@0.1.7 
├── karma-ie-launcher@0.1.5 
├── karma-jasmine@0.3.8 
├── karma-ng-html2js-preprocessor@0.1.2 
├── karma-opera-launcher@0.1.0 
├── karma-phantomjs-launcher@0.1.4

Not sure which bits of the config file are relevant, here is the whole thing.

Steps to reproduce the behaviour

  1. Clone my Repo (link above)
  2. Build it on Travis, or presumably any other ubuntu build server 3.
Florian-R commented 8 years ago

1969 #1988 and probably a few others

georgeedwards commented 8 years ago

@Florian-R Thanks for that. I am afraid I have already looked over these and a number of other issues.

I believe this was a bug which surfaced and was then fixed in release 0.13.19, so I don't believe those issues apply. #1751

I don't believe (?) there are any issues with my files declaration - certainly not my rx.js file. Sorry #1969

I also haven't been able to get this to work in any configuration (no folder move), so I am not sure #1988 applies.

sharikovvladislav commented 8 years ago

I have similar problem with TeamCity: https://github.com/karma-runner/karma/issues/1751#issuecomment-205171417 . Same karma version. I use karma-teamcity-reporter reporter.

georgeedwards commented 8 years ago

@sharikovvladislav Thanks for pointing out, you don't seem to be getting the:

TypeError: (msg || "").replace is not a function

line? Have you found a resolution to your issue?

georgeedwards commented 8 years ago

Would be grateful for any guidance as this is a bit of a show stopper for my testing at the moment ...

meriturva commented 8 years ago

The same here! I have same problems when running tests from Visual Studio/Gulp with reporters: ['progress'], browsers: ['Chrome'] and TeamCity with reporters: ['teamcity', 'coverage'], browsers: ['PhantomJS']

phhoangbao commented 8 years ago

@georgeedwards you can try to change line 14 of file: karma-test-shim.js from format: 'register' --> format: 'cjs', your tsconfig.js using commonjs.

I created simple application to simulate the error and fix. https://github.com/phhoangbao/angular2-test

Dillonmcewan commented 8 years ago

I'm also running into this issue. Has anyone found a solution?

meriturva commented 8 years ago

@Dillonmcewan hi...it is just an error on angular test configuration not karma related....i fixed using configuration from: https://github.com/antonybudianto/angular2-starter

vaudy commented 8 years ago

I had the same issue but I was missing a dependency in my package json.

WARN [web-server]: 404: /base/dist/vendor/lodash/lodash.min.js [INFO] Missing error handler on socket. [INFO] TypeError: (msg || "").replace is not a function

vaudy commented 8 years ago

have u try to load {pattern: 'karma-test-shim.js', included: true, watched: true} at the end before "tests/*_/__test.js" ?

Dillonmcewan commented 8 years ago

Was able to solve this. It happened several times and it always seemed to be a missing dependency in the files I was loading in my karma.conf.js. If the error message logged the file that was missing it would be much easier to track down the problem

joaopgrassi commented 8 years ago

I'm having the same issue. If I use reporters: ['progress'] everything works, but as soon as I add teamcity it gives the exact same error as @georgeedwards described. We've updated our app to Angular2 2.0.1 and since them this issue showed up. I don't think it is a configuration problem, otherwise with progress reporter it would also fail, I guess. @meriturva as I could see, you are also using teamcity. How did you ended up fixing it?

sharikovvladislav commented 5 years ago

Any news on this issue?

johnjbarton commented 5 years ago

I would say the evidence here points to team-city or config problems.

Please post your full error message