-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Fix tests: call end on response, not result of writeHead #543
base: main
Are you sure you want to change the base?
Conversation
The failing test is because the test doesn't have access to Travis secure variables: Line 7 in ddae5a3
It would pass if run by the main sockjs-client repo. |
@brycekahle can you please take a look at this PR? |
@@ -54,7 +54,8 @@ function startServer(port, config, prefix) { | |||
} else { | |||
serve(req, res, function(err) { | |||
var status = err ? err.statusCode : 404; | |||
return res.writeHead(status).end(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
res.writeHead
returns http.ServerResponse
, so the previous code should be OK. The docs even say:
Returns a reference to the ServerResponse, so that calls can be chained.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be... but in reality, the test doesn't pass without the change from this PR.
Have you tried?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which specific test(s) are you referring to?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's an example from #534
https://travis-ci.org/github/sockjs/sockjs-client/jobs/761021386#L416
And another from #536
https://travis-ci.org/github/sockjs/sockjs-client/jobs/762011841#L431
If you look the builds for some PRs, there are a number of examples.
No description provided.