Skip to content

Conversation

@Download
Copy link
Contributor

@Download Download commented Nov 25, 2020

The kind of change this PR does introduce

  • a bug fix
  • a new feature
  • an update to the documentation
  • a code change that improves performance
  • other

Current behavior

Tests fail on Windows because of the use of single quotes in NPM scripts where Windows only accepts double quotes and because of a bug in NYC that was fixed in 15.0.0.

New behavior

Tests run and succeed as expected.

Other information (e.g. related issues)

Full logs of fix + new results:

C:\ws\socketio>npm outdated
Package           Current    Wanted    Latest  Location
@types/mocha        8.0.3     8.0.4     8.0.4  socket.io
@types/node       14.14.7  14.14.10  14.14.10  socket.io
debug               4.1.1     4.1.1     4.3.1  socket.io
engine.io           4.0.1     4.0.4     4.0.4  socket.io
eslint             7.12.1    7.14.0    7.14.0  socket.io
mocha               3.5.3     3.5.3     8.2.1  socket.io
nyc                11.9.0    11.9.0    15.1.0  socket.io
prettier           1.19.1    1.19.1     2.2.0  socket.io
socket.io-parser    4.0.1     4.0.2     4.0.2  socket.io
superagent          3.8.3     3.8.3     6.1.0  socket.io
supertest           3.4.2     3.4.2     6.0.1  socket.io
typescript          4.0.5     4.1.2     4.1.2  socket.io

C:\ws\socketio>npm uninstall --save-dev nyc && npm install --save-dev nyc
removed 327 packages and audited 226 packages in 3.234s

14 packages are looking for funding
  run `npm fund` for details

found 3 vulnerabilities (2 low, 1 critical)
  run `npm audit fix` to fix them, or `npm audit` for details
+ [email protected]
added 99 packages from 78 contributors and audited 325 packages in 8.649s

20 packages are looking for funding
  run `npm fund` for details

found 3 vulnerabilities (2 low, 1 critical)
  run `npm audit fix` to fix them, or `npm audit` for details

C:\ws\socketio>npm test

> [email protected] test C:\ws\socketio
> npm run format:check && npm run compile && nyc mocha --require ts-node/register --reporter spec --slow 200 --bail --timeout 10000 test/socket.io.ts


> [email protected] format:check C:\ws\socketio
> prettier --check "lib/**/*.ts" "test/**/*.ts"

Checking formatting...
All matched files use Prettier code style!

> [email protected] compile C:\ws\socketio
> rimraf ./dist && tsc



  socket.io
    √ should be the same version as client
    server attachment
      http.Server
        √ should serve client
        √ should serve source map
        √ should serve client (min)
        √ should serve source map (min)
        √ should serve client (gzip)
        √ should serve bundle with msgpack parser
        √ should serve source map for bundle with msgpack parser
        √ should handle 304
        √ should not serve static files
        √ should work with #attach
        √ should work with #attach (and merge options)
      port
        √ should be bound
        √ should be bound as a string
        √ with listen
        √ as a string
    handshake
      √ should send the Access-Control-Allow-xxx headers on OPTIONS request
      √ should send the Access-Control-Allow-xxx headers on GET request
      √ should allow request if custom function in opts.allowRequest returns true
      √ should disallow request if custom function in opts.allowRequest returns false
    close
      √ should be able to close sio sending a srv
      √ should be able to close sio sending a port
      graceful close
        √ should stop socket and timers (4625ms)
    namespaces
      √ should be accessible through .sockets
      √ should be aliased
      √ should automatically connect
      √ should fire a `connection` event
      √ should fire a `connect` event
      √ should work with many sockets
      √ should be able to equivalently start with "" or "/" on server
      √ should be equivalent for "" and "/" on client
      √ should work with `of` and many sockets
      √ should work with `of` second param
      √ should disconnect upon transport disconnection
      √ should fire a `disconnecting` event just before leaving all rooms
      √ should return error connecting to non-existent namespace
      √ should not reuse same-namespace connections
      √ should find all clients in a namespace
      √ should find all clients in a namespace room
      √ should find all clients across namespace rooms
      √ should not emit volatile event after regular event (506ms)
      √ should emit volatile event (514ms)
      √ should enable compression by default
      √ should disable compression
      √ should throw on reserved event
      √ should close a client without namespace
      dynamic namespaces
        √ should allow connections to dynamic namespaces with a regex
        √ should allow connections to dynamic namespaces with a function
        √ should disallow connections when no dynamic namespace matches
    socket
      √ should not fire events more than once after manually reconnecting
      √ should not fire reconnect_failed event more than once when server closed (8262ms)
      √ should receive events
      √ should receive message events through `send`
      √ should error with null messages
      √ should handle transport null messages
      √ should emit events
      √ should emit events with utf8 multibyte character
      √ should emit events with binary data
      √ should emit events with several types of data (including binary)
      √ should receive events with binary data (133ms)
      √ should receive events with several types of data (including binary) (147ms)
      √ should not emit volatile event after regular event (polling) (212ms)
      √ should not emit volatile event after regular event (ws) (213ms)
      √ should emit volatile event (polling) (511ms)
      √ should emit volatile event (ws) (207ms)
      √ should emit only one consecutive volatile event (polling) (518ms)
      √ should emit only one consecutive volatile event (ws) (219ms)
      √ should emit regular events after trying a failed volatile event (polling) (219ms)
      √ should emit regular events after trying a failed volatile event (ws) (206ms)
      √ should emit message events through `send`
      √ should receive event with callbacks
      √ should receive all events emitted from namespaced client immediately and in order (118ms)
      √ should emit events with callbacks
      √ should receive events with args and callback
      √ should emit events with args and callback
      √ should receive events with binary args and callbacks (117ms)
      √ should emit events with binary args and callback
      √ should emit events and receive binary data in a callback (122ms)
      √ should receive events and pass binary data in a callback
      √ should have access to the client
      √ should have access to the connection
      √ should have access to the request
      √ should see query parameters in the request
      √ should see query parameters sent from secondary namespace connections in handshake object
      √ should handle very large json (3505ms)
      √ should handle very large binary data (2610ms)
      √ should be able to emit after server close and restart (2175ms)
      √ should enable compression by default
      √ should disable compression
Note: warning expected and normal in test.
Missing error handler on `socket`.
Error: Illegal attachments
    at Decoder.decodeString (C:\ws\socketio\node_modules\socket.io-parser\dist\index.js:160:23)
    at Decoder.add (C:\ws\socketio\node_modules\socket.io-parser\dist\index.js:105:27)
    at Client.ondata (C:\ws\socketio\dist\client.js:57:43)
    at Socket.emit (events.js:198:13)
    at Socket.onPacket (C:\ws\socketio\node_modules\engine.io\lib\socket.js:97:16)
    at WebSocket.emit (events.js:198:13)
    at WebSocket.onPacket (C:\ws\socketio\node_modules\engine.io\lib\transport.js:83:10)
    at WebSocket.onData (C:\ws\socketio\node_modules\engine.io\lib\transport.js:93:10)
    at WebSocket.onData (C:\ws\socketio\node_modules\engine.io\lib\transports\websocket.js:60:11)
    at WebSocket.emit (events.js:198:13)
    at Receiver.receiverOnMessage (C:\ws\socketio\node_modules\ws\lib\websocket.js:797:20)
    at Receiver.emit (events.js:198:13)
    at Receiver.dataMessage (C:\ws\socketio\node_modules\ws\lib\receiver.js:437:14)
    at Receiver.getData (C:\ws\socketio\node_modules\ws\lib\receiver.js:367:17)
    at Receiver.startLoop (C:\ws\socketio\node_modules\ws\lib\receiver.js:143:22)
    at Receiver._write (C:\ws\socketio\node_modules\ws\lib\receiver.js:78:10)
    at doWrite (_stream_writable.js:415:12)
    at writeOrBuffer (_stream_writable.js:399:5)
    at Receiver.Writable.write (_stream_writable.js:299:11)
    at Socket.socketOnData (C:\ws\socketio\node_modules\ws\lib\websocket.js:872:35)
    at Socket.emit (events.js:198:13)
    at addChunk (_stream_readable.js:288:12)
    at readableAddChunk (_stream_readable.js:269:11)
    at Socket.Readable.push (_stream_readable.js:224:10)
    at TCP.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)
      √ should error with raw binary and warn (222ms)
Note: warning expected and normal in test.
Missing error handler on `socket`.
Error: handle me please
    at Socket._onpacket (C:\ws\socketio\dist\socket.js:80:987)
    at C:\ws\socketio\dist\client.js:61:495
    at process._tickCallback (internal/process/next_tick.js:61:11)
      √ should not crash when receiving an error packet without handler (248ms)
      √ should not crash with raw binary (144ms)
      √ should handle empty binary packet (134ms)
      √ should not crash when messing with Object prototype (and other globals) (155ms)
      √ should throw on reserved event
      onAny
        √ should call listener
        √ should prepend listener
        √ should remove listener
    messaging many
      √ emits to a namespace
      √ emits binary data to a namespace
      √ emits to the rest
      √ emits to rooms (123ms)
      √ emits to rooms avoiding dupes
      √ broadcasts to rooms
      √ broadcasts binary data to rooms
      √ keeps track of rooms
      √ deletes empty rooms
      √ should properly cleanup left rooms
      √ allows to join several rooms at once
    middleware
      √ should call functions
      √ should pass errors
      √ should pass an object
      √ should only call connection after fns
      √ should only call connection after (lengthy) fns (319ms)
      √ should be ignored if socket gets closed
      √ should call functions in expected order (190ms)
      √ should disable the merge of handshake packets
      √ should work with a custom namespace


  118 passing (28s)

---------------------|---------|----------|---------|---------|---------------------------------------------------------
File                 | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
---------------------|---------|----------|---------|---------|---------------------------------------------------------
All files            |   84.95 |    77.92 |   81.45 |   85.99 |
 client.js           |    95.7 |    81.48 |     100 |   95.65 | 54,130,175,209
 index.js            |   78.03 |    76.32 |   70.45 |   80.57 | ...,146-147,241,246-249,255-260,306,337,358-359,379-411
 namespace.js        |   86.75 |    81.48 |      85 |   86.75 | 87-88,148,168,188-201,211
 parent-namespace.js |   95.65 |      100 |   85.71 |   95.65 | 29
 socket.js           |    85.9 |    77.78 |   82.35 |   85.81 | ...-229,267,291-301,327,357,375-376,408-409,465,477-488
---------------------|---------|----------|---------|---------|---------------------------------------------------------

This was referenced Nov 25, 2020
@darrachequesne darrachequesne merged commit 4e6d404 into socketio:master Nov 28, 2020
@darrachequesne
Copy link
Member

Awesome, thanks!

@Download Download mentioned this pull request Dec 5, 2020
2 tasks
dzad pushed a commit to dzad/socket.io that referenced this pull request May 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants