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

Correctly catch exception in http test #1475

Merged
merged 1 commit into from Apr 11, 2018

Conversation

codeclown
Copy link
Contributor

From this (doesn't exit):

$ grunt nodeunit:all
Running "nodeunit:all" (nodeunit) task
Testing http.js...........(node:89954) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 6): Error: connect ENOENT ./wrong.sock
(node:89954) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

To this:

$ grunt nodeunit:all
Running "nodeunit:all" (nodeunit) task
Testing http.js...........F..........
>> testSocket
>> Error: connect ENOENT ./wrong.sock
>>   at Object._errnoException (util.js:1024:11)
>>   at _exceptionWithHostPort (util.js:1046:20)
>>   at PipeConnectWrap.afterConnect [as oncomplete] (net.js:1182:14)

Warning: 1/29 assertions failed (656ms) Use --force to continue.

Aborted due to warnings.

Test it locally by changing this line in test testSocket in file test/unit/adapters/http.js:

socketPath: './test.sock',
// change to e.g.
socketPath: './wrong.sock',

Problems fixed:

  • test would leave hanging in case of exception
  • socket test.sock would never be closed -> subsequent runs would fail

Wanted to fix this after it caused trouble to figure out why a test was failing in another PR.

@emilyemorehouse emilyemorehouse merged commit 961ecd1 into axios:master Apr 11, 2018
@axios axios locked and limited conversation to collaborators May 3, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants