Skip to content

Use ephemeral port for testing - #71

Open
ishitatsuyuki wants to merge 2 commits into
espadrine:masterfrom
ishitatsuyuki:test
Open

Use ephemeral port for testing#71
ishitatsuyuki wants to merge 2 commits into
espadrine:masterfrom
ishitatsuyuki:test

Conversation

@ishitatsuyuki

Copy link
Copy Markdown
Contributor

Additionally, fix the issue where passing 0 to camp.start doesn't work.

@jankeromnes jankeromnes left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Very cool trick, thanks!

Looks good to me.

Comment thread test/test-api.js

// FIXME: is there a good way to make a server get a port for testing?
var server;
var portNumber = 8000;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Nit: Please keep a var portNumber; or var portNumber = 0; here instead of relying on the portNumber = ... above to create an accidental global.

Comment thread test/test-api.js
portNumber++;
serverStartDomain.run(startServer);
} else {
throw err;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Are you certain that serverStartDomain errors are automatically thrown when you don't have a .on('error', listener)?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

No it isn't. Can we just remove the domain wrapper here?

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Wasn't the domain's only purpose to handle EADDRINUSE? It seems like we can remove the domain altogether.

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