I am seeing this in the current test set up and would like to catch this kind of error from the karma server instance. Is that possible?
I'm only seeing this problem when using karma-jenkins-reporter or karma-junit-reporter, are you using any of these plugins?
no
+1 seeing this with karma-junit-reporter in my tests with Node 4.23 LTS...any ideas?
"karma": "~0.13.15",
"karma-chrome-launcher": "~0.2.0",
"karma-coverage": "~0.4.2",
"karma-firefox-launcher": "~0.1.6",
"karma-jasmine": "~0.3.6",
"karma-junit-reporter": "^0.2.2",
"karma-ng-html2js-preprocessor": "^0.1.2",
"karma-phantomjs-launcher": "~0.2.0",
"socket.io": "^1.3.7",
PhantomJS 1.9.8 (Mac OS X 0.0.0): Executed 48 of 277 (26 FAILED) ERROR (0.732 secs / 0.769 secs)
Missing error handler on socket.
TypeError: Cannot read property '68890579' of null
at specSuccess.specSkipped.specFailure (/Users/patrick/Projects/community/node_modules/karma-junit-reporter/index.js:89:22)
at onSpecComplete (/Users/patrick/Projects/community/node_modules/karma/lib/reporters/base.js:78:12)
at null.
at emitTwo (events.js:92:20)
at emit (events.js:172:7)
at onResult (/Users/patrick/Projects/community/node_modules/karma/lib/browser.js:216:13)
at Socket.
at emitOne (events.js:82:20)
at Socket.emit (events.js:169:7)
at Socket.onevent (/Users/patrick/Projects/community/node_modules/socket.io/lib/socket.js:330:8)
at Socket.onpacket (/Users/patrick/Projects/community/node_modules/socket.io/lib/socket.js:290:12)
at Client.ondecoded (/Users/patrick/Projects/community/node_modules/socket.io/lib/client.js:193:14)
at Decoder.Emitter.emit (/Users/patrick/Projects/community/node_modules/socket.io/node_modules/socket.io-parser/node_modules/component-emitter/index.js:134:20)
at Decoder.add (/Users/patrick/Projects/community/node_modules/socket.io/node_modules/socket.io-parser/index.js:247:12)
at Client.ondata (/Users/patrick/Projects/community/node_modules/socket.io/lib/client.js:175:18)
at emitOne (events.js:77:13)
at Socket.emit (events.js:169:7)
at Socket.onPacket (/Users/patrick/Projects/community/node_modules/socket.io/node_modules/engine.io/lib/socket.js:99:14)
at emitOne (events.js:82:20)
at WebSocket.emit (events.js:169:7)
at WebSocket.Transport.onPacket (/Users/patrick/Projects/community/node_modules/socket.io/node_modules/engine.io/lib/transport.js:91:8)
at WebSocket.Transport.onData (/Users/patrick/Projects/community/node_modules/socket.io/node_modules/engine.io/lib/transport.js:102:8)
Same error here: any suggestions?
PhantomJS 1.9.8 (Mac OS X 0.0.0): Executed 32 of 141 ERROR (0.428 secs / 0.427 secs)
Missing error handler on socket.
TypeError: Cannot read property '12945726' of null
Getting with PhantomJS and the spec reporter. Trying to figure out why it is only on CircleCI and not locally:
Missing error handler on `socket`.
TypeError: sockets.forEach is not a function
at disconnectBrowsers (/home/ubuntu/[app]/node_modules/karma/lib/server.js:314:13)
at [object Object].<anonymous> (/home/ubuntu/[app]/node_modules/karma/lib/server.js:291:7)
at emitTwo (events.js:92:20)
at [object Object].emit (events.js:172:7)
at emitRunCompleteIfAllBrowsersDone (/home/ubuntu/[app]/node_modules/karma/lib/server.js:256:12)
at [object Object].<anonymous> (/home/ubuntu/[app]/node_modules/karma/lib/server.js:278:9)
at emitTwo (events.js:92:20)
at [object Object].emit (events.js:172:7)
at [object Object].onComplete (/home/ubuntu/[app]/node_modules/karma/lib/browser.js:142:13)
at Socket.<anonymous> (/home/ubuntu/[app]/node_modules/karma/lib/events.js:13:22)
at emitTwo (events.js:92:20)
at Socket.emit (events.js:172:7)
at Socket.onevent (/home/ubuntu/[app]/node_modules/socket.io/lib/socket.js:335:8)
at Socket.onpacket (/home/ubuntu/[app]/node_modules/socket.io/lib/socket.js:295:12)
at Client.ondecoded (/home/ubuntu/[app]/node_modules/socket.io/lib/client.js:193:14)
at Decoder.Emitter.emit (/home/ubuntu/[app]/node_modules/component-emitter/index.js:134:20)
at Decoder.add (/home/ubuntu/[app]/node_modules/socket.io-parser/index.js:247:12)
at Client.ondata (/home/ubuntu/[app]/node_modules/socket.io/lib/client.js:175:18)
at emitOne (events.js:77:13)
at Socket.emit (events.js:169:7)
at Socket.onPacket (/home/ubuntu/[app]/node_modules/engine.io/lib/socket.js:101:14)
at emitOne (events.js:77:13)
Our issue was just fixed in 3ab78d63dbd2569abaf0d588230fa8c1afc1048a and shipped in 0.13.19. Thanks!
Confirmed fixed.
I'm still seeing this in 0.13.22
@adam-beck please provide a reproducible example.
@dignifiedquire what example do you want? I have same issue using karma: 0.13.22 and karma-teamcity-reporter: 0.2.2.
[10:09:26] Missing error handler on `socket`.
[10:09:26] Error: EAGAIN: resource temporarily unavailable, write
[10:09:26] at Error (native)
[10:09:26] at Function.fs.writeSync (fs.js:669:18)
[10:09:26] at /export/home/bc_prod1/buildAgent/work/dac7c6b3e0abf1a1/node_modules/karma/lib/reporters/base.js:51:7
[10:09:26] at Array.forEach (native)
[10:09:26] at write (/export/home/bc_prod1/buildAgent/work/dac7c6b3e0abf1a1/node_modules/karma/lib/reporters/base.js:50:19)
[10:09:26] at onBrowserLog (/export/home/bc_prod1/buildAgent/work/dac7c6b3e0abf1a1/node_modules/karma/lib/reporters/base.js:70:12)
[10:09:26] at null.<anonymous> (/export/home/bc_prod1/buildAgent/work/dac7c6b3e0abf1a1/node_modules/karma/lib/events.js:13:22)
[10:09:26] at emitThree (events.js:102:20)
[10:09:26] at emit (events.js:175:7)
[10:09:26] at onInfo (/export/home/bc_prod1/buildAgent/work/dac7c6b3e0abf1a1/node_modules/karma/lib/browser.js:111:15)
[10:09:26] at Socket.<anonymous> (/export/home/bc_prod1/buildAgent/work/dac7c6b3e0abf1a1/node_modules/karma/lib/events.js:13:22)
[10:09:26] at emitOne (events.js:82:20)
[10:09:26] at Socket.emit (events.js:169:7)
[10:09:26] at Socket.onevent (/export/home/bc_prod1/buildAgent/work/dac7c6b3e0abf1a1/node_modules/socket.io/lib/socket.js:335:8)
[10:09:26] at Socket.onpacket (/export/home/bc_prod1/buildAgent/work/dac7c6b3e0abf1a1/node_modules/socket.io/lib/socket.js:295:12)
[10:09:26] at Client.ondecoded (/export/home/bc_prod1/buildAgent/work/dac7c6b3e0abf1a1/node_modules/socket.io/lib/client.js:193:14)
Note, that I am getting this issue only in TeamCity environment. Karma runner works on Redhat 6. I can provide more info, if you need.
Same run on Windows 7 with same teamcity reporter works perfectly.
One of the differences: on teamcity all node packages in node_modules were installed in linux environment.
Looks like I got this error only on tests which are using httpBackend service. So I got this issue when some async factor influence test run.
Example of test:
it("livescrolling test", function () {
// mock
scope.a.b.c = {
foo: noopFn
};
$httpBackend.expectGET(/(.*?)a\/b\/c(.*?)/).respond({
a: [{a: 5, b: "someDate"}],
m: {
x: 10,
y: 20,
z: 0
}
});
// prepare
spyOn(scope.d.e.f, 'foo');
scope.m.n.o = [{a: 5, b: "someDate"}];
expect(scope.a.b.c).toEqual(1);
expect(scope.m.n.o).toEqual(10);
ctrl.someFoo(123, 456, true);
$httpBackend.flush();
expect(scope.a.b.c).toHaveBeenCalledWith({a: false});
});
fs throws error. Looks like some messages were pushed to somewhere (stdout) and fs thrown error about it is not available. May be it is because I don't use httpBackend correctly?
I've just run into this issue (via karma-junit-reporter); in our case the problem seemed to be a dependency that was mangled by a (company wifi) proxy / firewall / filter. Running npm install via a tethered smartphone resolved the issue. NPM needs signature verification.
+1 I'm getting the same error. To reproduce you can checkout my project here.
$> npm install
$> gulp test
Maybe you have to run gulp twice before you see this error.
Seeing same error as @sharikovvladislav when using karma and karma-teamcity-reporter together.
Missing error handler on `socket`.
Error: EAGAIN: resource temporarily unavailable, write
Minimal setup with which I am able to reproduce the error here
I get this error when i add 'browserify' to preprocessors.
preprocessors: {
'unit-test/linkers/**/!(*spec).js': ['coverage','browserify']
}
I was getting require not found when running karma, that made me add browserify, now i get this error
Confirm that I also get this error running MacOSX 10.11.1 (15B42):
Missing error handler onsocket.
TypeError: (msg || "").replace is not a function
Karma version is 0.13.22.
Seems this is back in Karma 1.1.0 (it was not occuring in 0.13.22)
I'm running tests with --single-run false in PhantomJS 2.1.1 on MacOSX 10.11.4
Output is:
PhantomJS 2.1.1 (Mac OS X 0.0.0): Executed 3281 of 3302 (skipped 21) SUCCESS (25.1 secs / 23.617 secs)
Missing error handler on 'socket'.
TypeError: Cannot read property '93062136' of null
at onBrowserComplete (/PATH-TO/node_modules/karma-junit-reporter/index.js:120:23)
at .<anonymous> (/PATH-TO/node_modules/karma/lib/events.js:13:22)
at emitTwo (events.js:111:20)
at emit (events.js:191:7)
at onComplete (/PATH-TO/node_modules/karma/lib/browser.js:143:13)
at Socket.<anonymous> (/PATH-TO/node_modules/karma/lib/events.js:13:22)
at emitTwo (events.js:111:20)
at Socket.emit (events.js:191:7)
at Socket.onevent (/PATH-TO/node_modules/socket.io/lib/socket.js:335:8)
at Socket.onpacket (/PATH-TO/node_modules/socket.io/lib/socket.js:295:12)
at Client.ondecoded (/PATH-TO/node_modules/socket.io/lib/client.js:193:14)
at Decoder.Emitter.emit (/PATH-TO/node_modules/component-emitter/index.js:134:20)
at Decoder.add (/PATH-TO/node_modules/socket.io-parser/index.js:247:12)
at Client.ondata (/PATH-TO/node_modules/socket.io/lib/client.js:175:18)
at emitOne (events.js:96:13)
at Socket.emit (events.js:188:7)
at Socket.onPacket (/PATH-TO/node_modules/engine.io/lib/socket.js:101:14)
at emitOne (events.js:96:13)
at WebSocket.emit (events.js:188:7)
at WebSocket.Transport.onPacket (/PATH-TO/node_modules/engine.io/lib/transport.js:104:8)
at WebSocket.Transport.onData (/PATH-TO/node_modules/engine.io/lib/transport.js:115:8)
at WebSocket.onData (/PATH-TO/node_modules/engine.io/lib/transports/websocket.js:76:30)
at emitTwo (events.js:106:13)
at WebSocket.emit (events.js:191:7)
at Receiver.ontext (/PATH-TO/node_modules/ws/lib/WebSocket.js:816:10)
at /PATH-TO/node_modules/ws/lib/Receiver.js:477:18
at Receiver.applyExtensions (/PATH-TO/node_modules/ws/lib/Receiver.js:364:5)
at /PATH-TO/node_modules/ws/lib/Receiver.js:466:14
at Receiver.flush (/PATH-TO/node_modules/ws/lib/Receiver.js:340:3)
at Receiver.opcodes.1.finish (/PATH-TO/node_modules/ws/lib/Receiver.js:482:12)
at Receiver.expectHandler (/PATH-TO/node_modules/ws/lib/Receiver.js:451:33)
at Receiver.add (/PATH-TO/node_modules/ws/lib/Receiver.js:95:24)
at Socket.realHandler (/PATH-TO/node_modules/ws/lib/WebSocket.js:800:20)
at emitOne (events.js:96:13)
at Socket.emit (events.js:188:7)
at readableAddChunk (_stream_readable.js:172:18)
at Socket.Readable.push (_stream_readable.js:130:10)
at TCP.onread (net.js:542:20)
PhantomJS 2.1.1 (Mac OS X 0.0.0) ERROR
Disconnectedundefined
+1
+1, I see the same behavior as @shoesel
+1, Having the issue as well
+1 having issue on karma 1.1.1 without karma-junit-reporter
I haven't been able to reproduce this issue, so I need a repo that I can clone and run that shows this issue.
I am also getting the same error with angular-cli project, I am using these versions:
"angular-cli": "^1.0.0-beta.10",
"karma": "0.13.22",
"karma-phantomjs-launcher": "^1.0.0",
"karma-jasmine": "0.3.8",
If anyone want to check - may clone this repo. Thanks.
Can this please be reopened? I'm getting the same error here.
Getting this same issue. Very basic configuration with angular cli.
getting the same issue
"karma": "0.13.22",
"karma-chrome-launcher": "0.2.3",
"karma-cli": "0.1.2",
"karma-jasmine": "0.3.8",
"karma-junit-reporter": "0.4.1",
"karma-notify-reporter": "0.1.1"
The problem for me was using Node v6 with karma-jenkins-reporter, which is apparently deprecated. The solution was to switch to karma-junit-reporter.
It happens for me with [email protected] and [email protected], but only when I have this plugin on my webpack config:
new WebpackShellPlugin({
onBuildStart: [ 'npm run generate-spec-with-all' ]
}),
The mentioned script just globs a folder, parses some file and generate a dumb spec file with only require calls. It runs fast and works if I call it as npm run generate-spec-with-all && before the test runner.
Update: and it happens only when calling with --auto-watch and --no-single-run.
+1 with karma 1.3.0 and karma-junit-reporter 1.1.0 on Ubuntu 16_04
Same problem here karma-junit-reporter 1.1.0, karma 1.3.0. Any leads?
I am only running into issues with Windows 8 now.
Upgrading PhantomJS and leaving grunt-karma out of the game fixed this for me. It seems to me that grunt-karma is causing the issue.
+1 for me
karma 1.3.0
+1
Same problem here karma-junit-reporter 1.1.0, karma 1.3.0, any news about this?
karma-junit-reporter 1.2.0 should make this error message go away. Though it's quite likely other reporter suffer from the same (or at least something very similar) issue. I'm pretty sure the Jenkins one does.
Most helpful comment
I'm still seeing this in
0.13.22