josephg/node-browserchannel

Tests do not pass

Closed this issue · 2 comments

Here is the output of npm test:

macbook:node-browserchannel luigi$ npm test

> browserchannel@2.0.0 test /Users/luigi/node-browserchannel
> mocha



  bcsocket
    ✓ states and errors are mapped 
    ✓ connect (156ms)
    ✓ connect sends app version (48ms)
    ✓ disconnecting immediately results in REQUEST_FAILED and a 403 (52ms)
    ✓ disconnecting momentarily allows the client to connect, then onclose() is called (55ms)
    ✓ passing a previous session will ghost that session (104ms)
    ✓ Line separator and paragraph separators work 
    ✓ extraParams are passed to the server (61ms)
    ✓ Session affinity tokens are generated by default (45ms)
    ✓ Session affinity tokens can be set manually (50ms)
    ✓ Session affinity GET variable can be modified (71ms)
    ✓ Session affinity tokens can be disabled (49ms)
    ✓ Extra headers are sent to the server (55ms)
    send maps
      ✓ immediately (49ms)
      ✓ after we have connected (73ms)
    can send and receive
      ✓ unicode (61ms)
      ✓ Lots of data (769ms)
      JSON messages
        ✓ immediately 
        1) after we have connected
      string messages
        2) immediately
        3) after we have connected
    The client keeps reconnecting
      4) When the connection fails
    stop
AssertionError: false == true
  at [object Object].socket.onmessage (/Users/luigi/node-browserchannel/test/bcsocket.coffee:195:11)
  at e (/Users/luigi/node-browserchannel/dist/node-bcsocket-uncompressed.js:2672:47)
  at Yd.g.channelHandleArray (/Users/luigi/node-browserchannel/dist/node-bcsocket-uncompressed.js:2699:12)
  at Fd.f.Sb (/Users/luigi/node-browserchannel/dist/node-bcsocket-uncompressed.js:2452:445)
  at pd (/Users/luigi/node-browserchannel/dist/node-bcsocket-uncompressed.js:1986:9)
  at od (/Users/luigi/node-browserchannel/dist/node-bcsocket-uncompressed.js:1863:32)
  at U.f.fc (/Users/luigi/node-browserchannel/dist/node-bcsocket-uncompressed.js:1838:49)
  at U.f.Cc (/Users/luigi/node-browserchannel/dist/node-bcsocket-uncompressed.js:1814:107)
  at yc (/Users/luigi/node-browserchannel/dist/node-bcsocket-uncompressed.js:1329:20)
  at O.f.dispatchEvent (/Users/luigi/node-browserchannel/dist/node-bcsocket-uncompressed.js:1299:76)
  at Sc (/Users/luigi/node-browserchannel/dist/node-bcsocket-uncompressed.js:1518:15)
  at O.f.vc (/Users/luigi/node-browserchannel/dist/node-bcsocket-uncompressed.js:1508:3)
  at O.f.Rb (/Users/luigi/node-browserchannel/dist/node-bcsocket-uncompressed.js:1505:63)
  at setState (/Users/luigi/node-browserchannel/XMLHttpRequest.js:344:9)
  at IncomingMessage.<anonymous> (/Users/luigi/node-browserchannel/XMLHttpRequest.js:235:7)
  at IncomingMessage.emit (events.js:95:17)
  at IncomingMessage.<anonymous> (_stream_readable.js:764:14)
  at IncomingMessage.emit (events.js:92:17)
  at emitReadable_ (_stream_readable.js:426:10)
  at emitReadable (_stream_readable.js:422:5)
  at readableAddChunk (_stream_readable.js:165:9)
  at IncomingMessage.Readable.push (_stream_readable.js:127:10)
  at HTTPParser.parserOnBody [as onBody] (http.js:142:22)
  at Socket.socketOnData [as ondata] (http.js:1587:20)
  at TCP.onread (net.js:527:27)

      ✓ on connect (10135ms)
      ✓ after connect (69ms)

  server
    ✓ The javascript is hosted at channel/bcsocket.js 
    ✓ GET /test/?mode=INIT with no baseprefix set returns [null, null] 
    ✓ GET /test/?mode=INIT with a basePrefix set returns [basePrefix, null] 
    ✓ The test channel responds at a bound custom endpoint 
    ✓ binding the server to a custom url without a leading slash works 
    ✓ binding the server to a custom url with a trailing slash works 
    ✓ CORS header is not sent if its not set in the options 
    ✓ CORS headers are sent during the initial phase if set in the options 
    ✓ CORS header is set on the backchannel response 
    ✓ Additional headers can be specified in the options 
    ✓ getting a url outside of the bound range gets passed to other middleware 
    ✓ getting a wacky url inside the bound range returns 404 
    ✓ The server sends accept:JSON header during test phase 1 
    ✓ The server sends standard headers during test phase 1 (64ms)
    ✓ Using type=html sets Content-Type: text/html 
    ✓ Using type=html gets the standard headers 
    ✓ The server makes a new session if the client POSTs the right connection stuff 
    ✓ A session has state=ok after onSession returns 
    ✓ A session connects ok even if it doesnt specify an app version 
    ✓ The client can post messages to the server during initialization 
    ✓ Server messages are properly URL decoded 
    ✓ The client can post messages to the server after initialization 
    ✓ The server acknowledges forward channel messages correctly 
    ✓ The server tells the client if the backchannel is alive (48ms)
    ✓ The server tells the client how much unacknowledged data there is in the post response 
    ✓ The server returns data on the initial connection when send is called immediately 
    ✓ The server escapes tricky characters before sending JSON over the wire 
    ✓ The server buffers data if no backchannel is available 
    ✓ The server returns data through the available backchannel when send is called later 
    ✓ The server calls send callback once data is acknowledged 
    ✓ The send callback can stop the session 
    ✓ The backchannel is closed after each packet if chunking is turned off 
    ✓ The backchannel is left open if CI=0 
    ✓ The server gives the client correctly formatted backchannel data if TYPE=html 
    ✓ The server sets the domain if we have a domain set 
    ✓ The server closes old backchannel connections 
    ✓ The server orders forwardchannel messages correctly using RIDs 
    ✓ Repeated forward channel messages are discarded (79ms)
    ✓ Repeat forward channel messages can contain extra maps 
    ✓ The server resends lost arrays if the client asks for them 
    ✓ If a client disconnects then reconnects, specifying OSID= and OAID=, the old session is destroyed 
    ✓ The server ignores OSID and OAID if the named session doesnt exist 
    ✓ The server uses OAID to confirm arrays in the old session before closing it 
    ✓ The session times out after awhile if it doesnt have a backchannel 
    ✓ The session can be disconnected by firing a GET with TYPE=terminate 
    ✓ If a disconnect message reaches the client before some data, the data is still received (66ms)
    ✓ The session times out if its backchannel is closed 
    ✓ A heartbeat is sent across the backchannel (by default) every 20 seconds (49ms)
    ✓ A server with an active backchannel doesnt timeout (55ms)
    ✓ If a session has close() called with no arguments, the send error message says "closed" 
    ✓ An immediate session.close() results in the initial connection getting a 403 response 
    ✓ close kills the active backchannel 
    ✓ The server decodes JSON data in a map if it has a JSON key 
    ✓ The server emits JSON data in a map, as a map as well 
    ✓ The server accepts JSON data 
    ✓ You can send null 
    ✓ Sessions are cancelled when close() is called on the server 
    CORS header is set in error responses
      ✓ backChannel 
      ✓ forwardChannel 
    Getting test phase 2 returns 11111 then 2
      ✓ xmlhttp 
      ✓ html 
    Getting /test/* without VER=8 returns an error
      ✓ phase 1, ver 7 
      ✓ phase 1, no version 
      ✓ phase 2, ver 7, xmlhttp 
      ✓ phase 2, no version, xmlhttp 
      ✓ phase 2, ver 7, http 
      ✓ phase 2, no version, http 
    Connecting with a version thats not 8 breaks
      ✓ no version 
      ✓ previous version 
    If a client sends an invalid SID in a request, the server responds with 400 Unknown SID
      ✓ backChannel 
      ✓ forwardChannel 
      ✓ backChannel with TYPE=html 
    The server calls send callbacks with an error
      ✓ when the session times out 
      ✓ when the session is ghosted (55ms)
      ✓ when the session is closed by the server 
      ✓ when the server gets a disconnect request 
    Calling stop() sends the stop command to the client
      5) during init
      6) "after each" hook


  96 passing (2m)
  6 failing

  1) bcsocket can send and receive JSON messages after we have connected:
     Error: timeout of 20000ms exceeded
    at [object Object].<anonymous> (/Users/luigi/node-browserchannel/node_modules/mocha/lib/runnable.js:158:19)
    at Timer.listOnTimeout [as ontimeout] (timers.js:112:15)


  2) bcsocket can send and receive string messages immediately:
     Error: timeout of 20000ms exceeded
    at [object Object].<anonymous> (/Users/luigi/node-browserchannel/node_modules/mocha/lib/runnable.js:158:19)
    at Timer.listOnTimeout [as ontimeout] (timers.js:112:15)


  3) bcsocket can send and receive string messages after we have connected:
     Error: timeout of 20000ms exceeded
    at [object Object].<anonymous> (/Users/luigi/node-browserchannel/node_modules/mocha/lib/runnable.js:158:19)
    at Timer.listOnTimeout [as ontimeout] (timers.js:112:15)


  4) bcsocket The client keeps reconnecting When the connection fails:
     Error: timeout of 20000ms exceeded
    at [object Object].<anonymous> (/Users/luigi/node-browserchannel/node_modules/mocha/lib/runnable.js:158:19)
    at Timer.listOnTimeout [as ontimeout] (timers.js:112:15)


  5) server Calling stop() sends the stop command to the client during init:
     Uncaught AssertionError: [[0,["c","bx1xxvi6",null,8]]] deepEqual [[0,["c","a9oc9loi",null,8]],[1,["stop"]]]
    at /Users/luigi/node-browserchannel/test/server.coffee:1331:18
    at /Users/luigi/node-browserchannel/test/server.coffee:170:5
    at IncomingMessage.res.on.listener (/Users/luigi/node-browserchannel/test/server.coffee:140:7)
    at IncomingMessage.emit (events.js:95:17)
    at IncomingMessage.<anonymous> (_stream_readable.js:764:14)
    at IncomingMessage.emit (events.js:92:17)
    at emitReadable_ (_stream_readable.js:426:10)
    at emitReadable (_stream_readable.js:422:5)
    at readableAddChunk (_stream_readable.js:165:9)
    at IncomingMessage.Readable.push (_stream_readable.js:127:10)
    at HTTPParser.parserOnBody [as onBody] (http.js:142:22)
    at Socket.socketOnData [as ondata] (http.js:1587:20)
    at TCP.onread (net.js:527:27)


  6) server "after each" hook:
     Error: timeout of 2000ms exceeded
    at [object Object].<anonymous> (/Users/luigi/node-browserchannel/node_modules/mocha/lib/runnable.js:158:19)
    at Timer.listOnTimeout [as ontimeout] (timers.js:112:15)




npm ERR! Test failed.  See above for more details.
macbook:node-browserchannel luigi$ node -v
v0.10.33

Hmm this is new and exciting. Thanks - I'll take a look.

tried to take a stab at this, but looks like travis has been red for a bit due to some fun with mocha