mirror of
https://github.com/cypress-io/cypress.git
synced 2026-03-18 10:22:50 -05:00
use a parser that supports circular json
This commit is contained in:
@@ -2,6 +2,7 @@ map = require("lodash/map")
|
||||
pick = require("lodash/pick")
|
||||
once = require("lodash/once")
|
||||
Promise = require("bluebird")
|
||||
{ circularParser } = require("@packages/socket")
|
||||
|
||||
HOST = "CHANGE_ME_HOST"
|
||||
PATH = "CHANGE_ME_PATH"
|
||||
@@ -41,7 +42,11 @@ connect = (host, path, io) ->
|
||||
|
||||
## cannot use required socket here due
|
||||
## to bug in socket io client with browserify
|
||||
client = io.connect(host, {path: path, transports: ["websocket"]})
|
||||
client = io.connect(host, {
|
||||
path: path,
|
||||
transports: ["websocket"]
|
||||
parser: circularParser
|
||||
})
|
||||
|
||||
client.on "automation:request", (id, msg, data) ->
|
||||
switch msg
|
||||
|
||||
@@ -12,6 +12,7 @@ import $Cypress, { $ } from '@packages/driver'
|
||||
const channel = io.connect({
|
||||
path: '/__socket.io',
|
||||
transports: ['websocket'],
|
||||
parser: io.circularParser,
|
||||
})
|
||||
|
||||
channel.on('connect', () => {
|
||||
|
||||
@@ -124,6 +124,7 @@ class Socket
|
||||
destroyUpgrade: false
|
||||
serveClient: false
|
||||
cookie: cookie
|
||||
parser: socketIo.circularParser
|
||||
})
|
||||
|
||||
startListening: (server, automation, config, options) ->
|
||||
|
||||
@@ -175,6 +175,7 @@ describe "Web Sockets", ->
|
||||
@wsClient = socketIo.client(@cfg.proxyUrl, {
|
||||
path: @cfg.socketIoRoute
|
||||
transports: ["websocket"]
|
||||
parser: socketIo.circularParser
|
||||
})
|
||||
@wsClient.on "connect", -> done()
|
||||
|
||||
@@ -197,6 +198,7 @@ describe "Web Sockets", ->
|
||||
agent: agent
|
||||
path: @cfg.socketIoRoute
|
||||
transports: ["websocket"]
|
||||
parser: socketIo.circularParser
|
||||
})
|
||||
@wsClient.on "connect", -> done()
|
||||
|
||||
@@ -220,6 +222,7 @@ describe "Web Sockets", ->
|
||||
@wsClient = socketIo.client("https://localhost:#{wssPort}", {
|
||||
agent: agent
|
||||
path: @cfg.socketIoRoute
|
||||
parser: socketIo.circularParser
|
||||
})
|
||||
@wsClient.on "connect", -> done()
|
||||
|
||||
|
||||
@@ -1 +1,5 @@
|
||||
const circularParser = require('socket.io-circular-parser')
|
||||
|
||||
module.exports = require('socket.io-client')
|
||||
|
||||
module.exports.circularParser = circularParser
|
||||
|
||||
@@ -4,12 +4,15 @@ const server = require('socket.io')
|
||||
const version = require('socket.io-client/package.json').version
|
||||
const clientPath = require.resolve('socket.io-client')
|
||||
const client = require('./client')
|
||||
const circularParser = require('socket.io-circular-parser')
|
||||
|
||||
module.exports = {
|
||||
server,
|
||||
|
||||
client,
|
||||
|
||||
circularParser,
|
||||
|
||||
getPathToClientSource () {
|
||||
// clientPath returns the path to socket.io-client/lib/index.js
|
||||
// so walk up two levels to get to the root
|
||||
|
||||
@@ -17,8 +17,9 @@
|
||||
"lib"
|
||||
],
|
||||
"dependencies": {
|
||||
"socket.io": "1.7.4",
|
||||
"socket.io-client": "1.7.4"
|
||||
"socket.io": "2.2.0",
|
||||
"socket.io-circular-parser": "3.1.2",
|
||||
"socket.io-client": "2.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"bin-up": "1.2.0",
|
||||
|
||||
Reference in New Issue
Block a user