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

Set up proxy event emitter before making a request #304

Merged
merged 1 commit into from
May 19, 2017

Conversation

alextes
Copy link
Contributor

@alextes alextes commented May 13, 2017

Recently, every time I run the full test suite nyc pesters me with its angry red uncovered L34 (in this PR). I decided to dive in and find out why. The reason is: we emit the protocol error before we've had the chance to attach an error listener. So Node blows up, and indeed we never execute the return statement.

Wrapping the first request in a setImmediate so the proxy event emitter can get set up makes more sense to me than removing the return statement. Maybe you feel the alternative works better. Your call!

EDIT: Spotting our code never hits that return statement or the rest of the function body the statement returns flow to is unlikely. On second thought, I'm strongly for my current approach; the only potential problem is practical issues with altering the code flow this way.

Copy link
Owner

@sindresorhus sindresorhus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. Can't think of any potential downsides.

@floatdrop floatdrop merged commit a299b00 into sindresorhus:master May 19, 2017
@alextes alextes deleted the increase-coverage branch May 20, 2017 13:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants