test: unflake har tests (#4335)

Our test server throws Parse Error when connection
aborts at unfortunate time.
This commit is contained in:
Dmitry Gozman 2020-11-04 10:24:01 -08:00 committed by GitHub
parent 5dc632b82e
commit 12afb79e73
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -89,15 +89,14 @@ class TestServer {
this.PREFIX = `${protocol}://localhost:${port}`;
this.CROSS_PROCESS_PREFIX = `${protocol}://127.0.0.1:${port}`;
this.EMPTY_PAGE = `${protocol}://localhost:${port}/empty.html`;
}
_onSocket(socket) {
this._sockets.add(socket);
// ECONNRESET is a legit error given
// that tab closing simply kills process.
// ECONNRESET and HPE_INVALID_EOF_STATE are legit errors given
// that tab closing aborts outgoing connections to the server.
socket.on('error', error => {
if (error.code !== 'ECONNRESET')
if (error.code !== 'ECONNRESET' && error.code !== 'HPE_INVALID_EOF_STATE')
throw error;
});
socket.once('close', () => this._sockets.delete(socket));