Ignore node network errors after opening client socket #220
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is another stab at fixing High Sierra tests for nes.
Since ws 3.3.3, node net.Socket errors are reemitted by ws. We aren't really interested in these events, since they are not emitted by browser implementations of websockets. What we're interested in in those cases is the close event which will be emitted by both browser and ws.
In our tests we close both server and websocket at the same time, meaning the server could close the TCP socket at the same time the client sends a close frame, which causes a ECONNRESET socket error. For some reason (timing difference?) this manifests in Mac OS X High Sierra by logging or throwing an error for each test. In some cases it just causes console noise. in other cases where no onerror is defined it will throw and cause the test to fail.
I brought this up on ws: websockets/ws#1316
The advice is to ignore net.Socket errors once the websocket is open, and in fact these won't even be emitted by ws in future versions. Doing so in nes and attaching onerror handlers for where we use raw ws in the tests fixes all the test issues AFAIK.
Closes #216