Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow circular structures to be sent over the websocket, make it an error to send circular request bodies #4407

Merged
merged 18 commits into from Jun 13, 2019

Conversation

2 participants
@flotwig
Copy link
Member

commented Jun 6, 2019

  • Fixes #4346
  • Fixes #1958
  • Upgrades socket.io from 1.7.4 to 2.2.0 so that custom parsers are supported
  • Uses https://github.com/cypress-io/socket.io-circular-parser instead of Socket.io's default parser so that we can handle circular structures
  • Adds a better error if a user passes a circular request body in
    • Even with circular JSON support in the socket, request lib can't serialize a recursive body (of course), so we should warn the user that they're sending an invalid body
    • image

Thought about using flatted (the successor to circular-json), but jsperf shows it performs 50% slower: https://jsperf.com/flatted-vs-circularjson

flotwig added some commits Jun 6, 2019

@flotwig flotwig changed the title [WIP] Allow circular structures to be sent over the websocket [WIP] Allow circular structures to be sent over the websocket, make it an error to send circular request bodies Jun 6, 2019

@flotwig flotwig changed the title [WIP] Allow circular structures to be sent over the websocket, make it an error to send circular request bodies Allow circular structures to be sent over the websocket, make it an error to send circular request bodies Jun 7, 2019

@flotwig flotwig requested a review from cypress-io/test-runner Jun 7, 2019

@brian-mann
Copy link
Member

left a comment

  • use the global io instead of requiring in @packages/socket in the extension.
  • build the extension to look at the source to ensure it's not packaging up socket.io twice
  • we need to write a single "e2e / driver" test that passes in a circular dep.
  • the test could be simple like something in cypress_spec.coffee or similar. we just need to use Cypress.backend(...) and pass in an object that would cause it to normally fail

@flotwig flotwig force-pushed the issue-4346 branch from 8d3c57b to 05a4247 Jun 12, 2019

flotwig added some commits Jun 12, 2019

@flotwig flotwig force-pushed the issue-4346 branch from 368ead8 to 4091206 Jun 12, 2019

flotwig added some commits Jun 6, 2019

flotwig and others added some commits Jun 13, 2019

cleanup bundling of socket.io for node + browser
- keep the interfaces identical
- browser simply has less properties than the node variant

@brian-mann brian-mann merged commit d185a74 into develop Jun 13, 2019

23 checks passed

ci/circleci: Linux lint Your tests passed on CircleCI!
Details
ci/circleci: Mac build Your tests passed on CircleCI!
Details
ci/circleci: Mac lint Your tests passed on CircleCI!
Details
ci/circleci: build Your tests passed on CircleCI!
Details
ci/circleci: desktop-gui-integration-tests-2x Your tests passed on CircleCI!
Details
ci/circleci: driver-integration-tests-3x Your tests passed on CircleCI!
Details
ci/circleci: lint-typescript Your tests passed on CircleCI!
Details
ci/circleci: reporter-integration-tests Your tests passed on CircleCI!
Details
ci/circleci: run-launcher Your tests passed on CircleCI!
Details
ci/circleci: server-e2e-tests-1 Your tests passed on CircleCI!
Details
ci/circleci: server-e2e-tests-2 Your tests passed on CircleCI!
Details
ci/circleci: server-e2e-tests-3 Your tests passed on CircleCI!
Details
ci/circleci: server-e2e-tests-4 Your tests passed on CircleCI!
Details
ci/circleci: server-e2e-tests-5 Your tests passed on CircleCI!
Details
ci/circleci: server-e2e-tests-6 Your tests passed on CircleCI!
Details
ci/circleci: server-e2e-tests-7 Your tests passed on CircleCI!
Details
ci/circleci: server-e2e-tests-8 Your tests passed on CircleCI!
Details
ci/circleci: server-integration-tests Your tests passed on CircleCI!
Details
ci/circleci: server-performance-tests Your tests passed on CircleCI!
Details
ci/circleci: server-unit-tests Your tests passed on CircleCI!
Details
ci/circleci: unit-tests Your tests passed on CircleCI!
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
license/cla Contributor License Agreement is signed.
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.