karma: sockets.forEach is not a function
Running karma 0.13.16 I encountered the following issue after the last test run successfully:
Missing error handler on `socket`.
TypeError: sockets.forEach is not a function
at disconnectBrowsers (/project-path/node_modules/karma/lib/server.js:314:13)
at [object Object].<anonymous> (/project-path/node_modules/karma/lib/server.js:291:7)
at emitTwo (events.js:92:20)
at [object Object].emit (events.js:172:7)
at emitRunCompleteIfAllBrowsersDone (/project-path/node_modules/karma/lib/server.js:256:12)
at [object Object].<anonymous> (/project-path/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 (/project-path/node_modules/karma/lib/browser.js:142:13)
at Socket.<anonymous> (/project-path/node_modules/karma/lib/events.js:13:22)
at emitTwo (events.js:92:20)
at Socket.emit (events.js:172:7)
at Socket.onevent (/project-path/node_modules/socket.io/lib/socket.js:335:8)
at Socket.onpacket (/project-path/node_modules/socket.io/lib/socket.js:295:12)
at Client.ondecoded (/project-path/node_modules/socket.io/lib/client.js:193:14)
at Decoder.Emitter.emit (/project-path/node_modules/component-emitter/index.js:134:20)
at Decoder.add (/project-path/node_modules/socket.io-parser/index.js:247:12)
at Client.ondata (/project-path/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 (/project-path/node_modules/engine.io/lib/socket.js:101:14)
at emitOne (events.js:77:13)
at WebSocket.emit (events.js:169:7)
at WebSocket.Transport.onPacket (/project-path/node_modules/engine.io/lib/transport.js:93:8)
at WebSocket.Transport.onData (/project-path/node_modules/engine.io/lib/transport.js:104:8)
at WebSocket.onData (/project-path/node_modules/engine.io/lib/transports/websocket.js:76:30)
at emitTwo (events.js:87:13)
at WebSocket.emit (events.js:172:7)
at Receiver.ontext (/project-path/node_modules/ws/lib/WebSocket.js:816:10)
at Receiver.parse (/project-path/node_modules/ws/lib/Receiver.hixie.js:145:8)
at doAdd (/project-path/node_modules/ws/lib/Receiver.hixie.js:104:19)
at Receiver.add (/project-path/node_modules/ws/lib/Receiver.hixie.js:108:22)
at Socket.realHandler (/project-path/node_modules/ws/lib/WebSocket.js:800:20)
at emitOne (events.js:77:13)
at Socket.emit (events.js:169:7)
at readableAddChunk (_stream_readable.js:146:16)
at Socket.Readable.push (_stream_readable.js:110:10)
at TCP.onread (net.js:523:20)
05 01 2016 23:59:46.725:WARN [PhantomJS 1.9.8 (Linux 0.0.0)]: Disconnected (1 times), because no message in 10000 ms.
JS 1.9.8 (Linux 0.0.0): Executed 42 of 42 DISCONNECTED (10.248 secs / 0.329 secs)
05 01 2016 23:59:46.726:ERROR [karma]: [TypeError: sockets.forEach is not a function]
TypeError: sockets.forEach is not a function
at disconnectBrowsers (/project-path/node_modules/karma/lib/server.js:314:13)
at [object Object].<anonymous> (/project-path/node_modules/karma/lib/server.js:291:7)
at emitTwo (events.js:92:20)
at [object Object].emit (events.js:172:7)
at emitRunCompleteIfAllBrowsersDone (/project-path/node_modules/karma/lib/server.js:256:12)
at [object Object].<anonymous> (/project-path/node_modules/karma/lib/server.js:278:9)
at emitOne (events.js:82:20)
at [object Object].emit (events.js:169:7)
at [object Object]._onTimeout (/project-path/node_modules/karma/lib/browser.js:50:15)
at Timer.listOnTimeout (timers.js:92:15)
/project-path/node_modules/karma/lib/server.js:314
sockets.forEach(function (socket) {
^
TypeError: sockets.forEach is not a function
at disconnectBrowsers (/project-path/node_modules/karma/lib/server.js:314:13)
at process.<anonymous> (/project-path/node_modules/karma/lib/server.js:355:5)
at emitOne (events.js:77:13)
at process.emit (events.js:169:7)
at process._fatalException (node.js:234:26)
I didn’t make any changes to the code or to the test itself but reinstalled the node_modules.
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 37 (9 by maintainers)
Commits related to this issue
- Downgrade karma temporarily due to bug Newer versions of karma have an unfixed bug: https://github.com/karma-runner/karma/issues/1782 Should set to upgrade patch versions automatically after its fix... — committed to msecret/cf-deck by deleted user 8 years ago
- Bug 1237244 - Update to karma v0.13.19 to support new socket.io API socket.io released backwards incompatible API changes in a minor version update, causing failures during our ui-tests travis run. S... — committed to mozilla/treeherder by deleted user 8 years ago
- fix(server): Handle new socket.io internal format. Fixes #1782 — committed to budde377/karma by dignifiedquire 8 years ago
- downgrade karma to 0.13.8 since karma 0.13.10 is broken see karma-runner/karma#1782 for further information — committed to Sententiaregum/axios by Ma27 8 years ago
- Hardcoding karma version number to 0.13.15 until a gulp-related bug is solved. See: - https://github.com/karma-runner/karma/issues/1788 - https://github.com/karma-runner/karma/issues/1782 — committed to imgix/web-tools by deleted user 8 years ago
- Update karma to 0.13.19 This corrects an issue [1] where an error would be thrown. TypeError: sockets.forEach is not a function [1] https://github.com/karma-runner/karma/issues/1782 — committed to badeball/xpath-dom by badeball 8 years ago
- Update karma and firefox-launcher deps Includes upstream fixes: https://github.com/karma-runner/karma/issues/1782 https://github.com/karma-runner/karma-firefox-launcher/pull/44 — committed to joshgillies/jss by joshgillies 8 years ago
- chore(tests): fix socket error in karma related with karma-runner/karma#1782 — committed to kamilkisiela/angular-formly by deleted user 8 years ago
- Updated karma version due to breaking change in socket.io. See https://github.com/karma-runner/karma/issues/1782 — committed to ceepeeuk/angular2-systemjs-karma-typescript by ceepeeuk 8 years ago
- chore(tests): fix socket error in karma related with karma-runner/karma#1782 — committed to kamilkisiela/angular-formly by deleted user 8 years ago
- Bump karma version, see https://github.com/karma-runner/karma/issues/1782 — committed to DavidSouther/Montana-News-Archive by DavidSouther 8 years ago
- Ongelma käytettyjen komponenttien yhteentoimivuudessa: https://github.com/karma-runner/karma/issues/1782 Päivitetty karma versioon 0.13.19 vinkkien perusteella. — committed to CSCfi/arvo by latec 8 years ago
- Bumping Karma version to get around an error with Socket.IO (https://github.com/karma-runner/karma/issues/1782). — committed to rehabstudio/fe-skeleton-testsuite by anthonyhastings 8 years ago
- Increased karma version. socket.io made recent breaking changes to their internals that older versions of karma uses (See karma-runner/karma#1782). The old bug with newer karma versions has disappea... — committed to shaka-project/shaka-player by TheModMaker 8 years ago
- Update karma to 0.13.19 Fixes error with socket.io mentioned in issue karma-runner/karma#1782 — committed to tfoxy/js-data by tfoxy 8 years ago
- Update karma to 0.13.19 Fixes error with socket.io mentioned in issue karma-runner/karma#1782 — committed to tfoxy/js-data-http by tfoxy 8 years ago
- Ongelma käytettyjen komponenttien yhteentoimivuudessa: https://github.com/karma-runner/karma/issues/1782 Päivitetty karma versioon 0.13.19 vinkkien perusteella. — committed to CSCfi/arvo by latec 8 years ago
- Fix karma version (see https://github.com/karma-runner/karma/issues/1782) — committed to Romakita/angular-typescript by Romakita 8 years ago
- Adds .travis.yml and gulp test task This commit also updates karam to 0.13.22 to avoid karma-runner/karma#1782 (sockets.forEach is not a function) when running gulp test. — committed to benjamin-albert/dillinger by benjamin-albert 8 years ago
- Adds .travis.yml and gulp test task This commit also updates karam to 0.13.22 to avoid karma-runner/karma#1782 (sockets.forEach is not a function) when running gulp test. — committed to benjamin-albert/dillinger by benjamin-albert 8 years ago
I succeed!!! I input ‘npm install socket.io@1.3.5 --save’ in command and it is work~
Just published
0.13.19which fixes this.Yep I’m seeing it once again too.
I seem to still have this problem with the latest version of Karma:
Any idea what it could be? Tried downgrading to .19, but I had the same problem.
This is due to socket.io bumping to 1.4.0. 1.3.7 worked just fine. We are having this problem too and it is causing our CI to fail.