karma icon indicating copy to clipboard operation
karma copied to clipboard

Missing error handler on `socket`

Open georgeedwards opened this issue 9 years ago • 15 comments

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 version (output of karma --version):
  • Relevant part of your karma.config.js file
├── [email protected] 
├── [email protected] 
├── [email protected] 
├── [email protected] 
├── [email protected] 
├── [email protected] 
├── [email protected] 
├── [email protected] 
├── [email protected]

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.

georgeedwards avatar Apr 05 '16 09:04 georgeedwards

#1969 #1988 and probably a few others

Florian-R avatar Apr 05 '16 10:04 Florian-R

@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.

georgeedwards avatar Apr 05 '16 10:04 georgeedwards

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.

sharikovvladislav avatar Apr 05 '16 14:04 sharikovvladislav

@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 avatar Apr 05 '16 14:04 georgeedwards

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

georgeedwards avatar Apr 06 '16 16:04 georgeedwards

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']

meriturva avatar Apr 12 '16 06:04 meriturva

@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

phhoangbao avatar Apr 23 '16 12:04 phhoangbao

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

Dillonmcewan avatar May 10 '16 21:05 Dillonmcewan

@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

meriturva avatar May 11 '16 06:05 meriturva

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

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

vaudy avatar Jun 15 '16 18:06 vaudy

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

vaudy avatar Jun 15 '16 18:06 vaudy

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

Dillonmcewan avatar Jun 15 '16 19:06 Dillonmcewan

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?

joaopgrassi avatar Oct 19 '16 09:10 joaopgrassi

Any news on this issue?

sharikovvladislav avatar Oct 07 '19 21:10 sharikovvladislav

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

Please post your full error message

johnjbarton avatar Oct 07 '19 22:10 johnjbarton